From 4786d195424e7e0efa13bd5e3c496005a9d8180c Mon Sep 17 00:00:00 2001 From: Julien Miotte Date: Thu, 19 May 2011 17:11:36 +0200 Subject: Making comparisons with non-GitPython objects more tolerant. --- git/objects/base.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'git/objects/base.py') diff --git a/git/objects/base.py b/git/objects/base.py index e51afbed..61b3e674 100644 --- a/git/objects/base.py +++ b/git/objects/base.py @@ -84,10 +84,14 @@ class Object(LazyMixin): def __eq__(self, other): """:return: True if the objects have the same SHA1""" + if not hasattr(other, 'binsha'): + return False return self.binsha == other.binsha def __ne__(self, other): """:return: True if the objects do not have the same SHA1 """ + if not hasattr(other, 'binsha'): + return True return self.binsha != other.binsha def __hash__(self): -- cgit v1.2.1