From accfe361443b3cdb8ea43ca0ccb8fbb2fa202e12 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 26 Nov 2009 18:16:13 +0100 Subject: tree: added traversal method, adjusted tests Fixed critical bug in object code: IndexObjects now use their path as hashkey, not the data\! --- lib/git/objects/base.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/git/objects/base.py') 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 ) -- cgit v1.2.1