TreeEntry equality testing
ssadler opened this issue · 2 comments
ssadler commented
So I am comparing 2 different versions of a TreeEntry at the same path in my repository, and the equality test returns True even though they have different OIDs. Just pointing it out, it wasn't hard to find but it seems counter intuitive to me.
(Pdb) (item1.oid, item2.oid)
(d21644a6c7570de018ea623d37732b8e549218ec, c9f6f5428e80fb5d3954ccf0ae2ca24c1c999f53)
(Pdb) (item1.name, item2.name)
('tx', 'tx')
(Pdb) item1 == item2
True
Otherwise, thanks for the great lib!
carlosmn commented
It's a bit unfortunate that we use git_tree_entry_cmp() for equality, since that's not what the function is meant to do. It is instead meant for sorting in a git-compatible manner and as such only checks for the name and the filemode, as that's what the sorting needs to do.