I found that object equality does not work with pygit2.Commit objects.
Digging deeper it looks like there is no implementation of __eq__ (going all the way back to object) so it falls back to __hash__, and pygit2.Commit.__hash__ is just falls back to object.__hash__.
Which causes this to happen.
python3.6.7
>>> import pygit2
>>> repo = pygit2.Repository('.')
>>> repo.head.get_object() == repo.head.get_object()
False
This behavior is confusing and work arounds are quite messy.
I found that object equality does not work with
pygit2.Commitobjects.Digging deeper it looks like there is no implementation of
__eq__(going all the way back toobject) so it falls back to__hash__, andpygit2.Commit.__hash__is just falls back toobject.__hash__.Which causes this to happen.
This behavior is confusing and work arounds are quite messy.