Skip to content

Commit 0968971

Browse files
author
Julien Miotte
committed
Making comparisons with non-GitPython objects more tolerant.
1 parent e7fa5ef commit 0968971

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

git/objects/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ def _set_cache_(self, attr):
7777

7878
def __eq__(self, other):
7979
""":return: True if the objects have the same SHA1"""
80+
if not hasattr(other, 'binsha'):
81+
return False
8082
return self.binsha == other.binsha
8183

8284
def __ne__(self, other):
8385
""":return: True if the objects do not have the same SHA1 """
86+
if not hasattr(other, 'binsha'):
87+
return True
8488
return self.binsha != other.binsha
8589

8690
def __hash__(self):

0 commit comments

Comments
 (0)