summaryrefslogtreecommitdiff
path: root/lib/git/objects/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-11-26 18:16:13 +0100
committerSebastian Thiel <byronimo@gmail.com>2009-11-26 18:16:13 +0100
commitaccfe361443b3cdb8ea43ca0ccb8fbb2fa202e12 (patch)
treea7786d8ac7fa5772506d9020f0221997991f1b28 /lib/git/objects/base.py
parent7ef66a66dc52dcdf44cebe435de80634e1beb268 (diff)
downloadgitpython-accfe361443b3cdb8ea43ca0ccb8fbb2fa202e12.tar.gz
tree: added traversal method, adjusted tests
Fixed critical bug in object code: IndexObjects now use their path as hashkey, not the data\!
Diffstat (limited to 'lib/git/objects/base.py')
-rw-r--r--lib/git/objects/base.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py
index c7bf5bf2..ddd03400 100644
--- a/lib/git/objects/base.py
+++ b/lib/git/objects/base.py
@@ -173,6 +173,14 @@ class IndexObject(Object):
if isinstance(mode, basestring):
self.mode = self._mode_str_to_int(mode)
+ def __hash__(self):
+ """
+ Returns
+ Hash of our path as index items are uniquely identifyable by path, not
+ by their data !
+ """
+ return hash(self.path)
+
def _set_cache_(self, attr):
if attr in IndexObject.__slots__:
# they cannot be retrieved lateron ( not without searching for them )