diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2011-05-19 14:00:22 -0700 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2011-05-19 14:00:22 -0700 |
commit | 35bceb16480b21c13a949eadff2aca0e2e5483fe (patch) | |
tree | a0c04f104f24cfc05e97f0b08194b2afa756adbe | |
parent | e7fa5ef735754e640bd6be6c0a77088009058d74 (diff) | |
parent | 096897123ab5d8b500024e63ca81b658f3cb93da (diff) | |
download | gitpython-35bceb16480b21c13a949eadff2aca0e2e5483fe.tar.gz |
Merge pull request #16 from mike-perdide/master
improved comparison between Object instances to check for compatibility of the other side first. Previously, and exception would be thrown.
This adds convenience in an area which probably is not performance critical.
-rw-r--r-- | git/objects/base.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git/objects/base.py b/git/objects/base.py index 5f2f7809..9c1a0bb9 100644 --- a/git/objects/base.py +++ b/git/objects/base.py @@ -77,10 +77,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): |