@@ -110,6 +110,7 @@ def _iter_from_data(self):
110110 i += 1
111111 # END while not reached NULL
112112 name = data [ns :i ]
113+ path = os .path .join (self .path , name )
113114
114115 # byte is NULL, get next 20
115116 i += 1
@@ -119,9 +120,9 @@ def _iter_from_data(self):
119120 mode |= type_id << 12
120121 hexsha = sha_to_hex (sha )
121122 if type_id == self .blob_id or type_id == self .symlink_id :
122- yield blob .Blob (self .repo , hexsha , mode , name )
123+ yield blob .Blob (self .repo , hexsha , mode , path )
123124 elif type_id == self .tree_id :
124- yield Tree (self .repo , hexsha , mode , name )
125+ yield Tree (self .repo , hexsha , mode , path )
125126 elif type_id == self .commit_id :
126127 # todo
127128 yield None
@@ -157,8 +158,6 @@ def __repr__(self):
157158 def _iter_recursive (cls , repo , tree , cur_depth , max_depth , predicate , prune ):
158159
159160 for obj in tree :
160- # adjust path to be complete
161- obj .path = os .path .join (tree .path , obj .path )
162161 if predicate (obj ):
163162 yield obj
164163 if obj .type == "tree" and ( max_depth < 0 or cur_depth + 1 <= max_depth ) and not prune (obj ):
@@ -173,7 +172,8 @@ def traverse(self, max_depth=-1, predicate = lambda i: True, prune = lambda t: F
173172 Returns
174173
175174 Iterator to traverse the tree recursively up to the given level.
176- The iterator returns Blob and Tree objects
175+ The iterator returns Blob and Tree objects with paths relative to their
176+ repository.
177177
178178 ``max_depth``
179179
0 commit comments