@@ -102,13 +102,13 @@ def tree_entries_from_data(data: bytes) -> List[EntryTup]:
102102 return out
103103
104104
105- def _find_by_name (tree_data : Sequence [EntryTupOrNone ], name : str , is_dir : bool , start_at : int
105+ def _find_by_name (tree_data : List [EntryTupOrNone ], name : str , is_dir : bool , start_at : int
106106 ) -> EntryTupOrNone :
107107 """return data entry matching the given name and tree mode
108108 or None.
109109 Before the item is returned, the respective data item is set
110110 None in the tree_data list to mark it done"""
111- tree_data_list : List [EntryTupOrNone ] = list ( tree_data )
111+ tree_data_list : List [EntryTupOrNone ] = tree_data
112112 try :
113113 item = tree_data_list [start_at ]
114114 if item and item [2 ] == name and S_ISDIR (item [1 ]) == is_dir :
@@ -160,6 +160,7 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by
160160 set it '' for the first iteration
161161 :note: The ordering of the returned items will be partially lost"""
162162 trees_data : List [List [EntryTupOrNone ]] = []
163+
163164 nt = len (tree_shas )
164165 for tree_sha in tree_shas :
165166 if tree_sha is None :
@@ -193,8 +194,7 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by
193194 # ti+nt, not ti+1+nt
194195 for tio in range (ti + 1 , ti + nt ):
195196 tio = tio % nt
196- td = trees_data [tio ]
197- entries [tio ] = _find_by_name (td , name , is_dir , ii )
197+ entries [tio ] = _find_by_name (trees_data [tio ], name , is_dir , ii )
198198
199199 # END for each other item data
200200 # if we are a directory, enter recursion
0 commit comments