Skip to content

index: map git_index_conflict_add #1382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eantoranz
Copy link
Contributor

map libgit2's git_index_conflict_add() as Index.add_conflict().

map libgit2's git_index_conflict_add() as Index.add_conflict().
@eantoranz eantoranz force-pushed the git_index_conflict_add branch from 0e1538c to 7e00418 Compare June 27, 2025 20:03
@eantoranz
Copy link
Contributor Author

Interesting that it failed for macos (and that the feedback already tips that it might be a problem in libgit2).

err = C.git_index_conflict_add(
self._index, centry_ancestor, centry_ours, centry_theirs
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something to do with the centries after using them in git_index_conflict_add()?

@jdavid
Copy link
Member

jdavid commented Jun 28, 2025

Reading cffi's documentation, centries will be garbage collected, so there is nothing to do with it.

@jdavid
Copy link
Member

jdavid commented Jul 6, 2025

Interesting that it failed for macos (and that the feedback already tips that it might be a problem in libgit2).

What do you mean? I don't see a clue about libgit2 here:

        conflict = index.conflicts['conflict.txt']
>       assert conflict[0].id == ancestor_blob_id
               ^^^^^^^^^^^^^^
E       AttributeError: 'NoneType' object has no attribute 'id'
test/test_index.py:331: AttributeError

@eantoranz
Copy link
Contributor Author

Interesting that it failed for macos (and that the feedback already tips that it might be a problem in libgit2).

What do you mean? I don't see a clue about libgit2 here:

It is not me who tipped about libgit2 being the culprint. It's feedback from the failed test, actually:

=========================== short test summary info ============================
SKIPPED [1] test/test_credentials.py:191: Requires proxy at port 8888
SKIPPED [1] test/test_repository.py:741: Requires proxy at port 8888
XFAIL test/test_nonunicode.py::test_nonunicode_branchname - probably a bug in libgit2 for non-linux platforms <==== HERE
FAILED test/test_index.py::test_add_conflict - AttributeError: 'NoneType' object has no attribute 'id'
====== 1 failed, 524 passed, 2 skipped, 1 xfailed, 10 warnings in 29.74s =======
Error: Process completed with exit code 1.

And given that the other platforms pass having the exact same code on pygit2 (and not much room for behavior differences there), I can only assume that the call to libgit2's git_index_conflict_add inside Index.add_conflict here is providing a NULL value where it is actually not expected. So... I think the description from the tests feedback pointing at libgit2 makes sense in this context. Am I missing something?

Just in case, what should be the right way to handle this? Should I go into libgit2, find the root cause of the test failure there, fix it and create a PR? It could get tricky given that I do not have a mac at hand so all I could do is just read code and try to make some (theoretical) sense as to why it might be failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants