File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -136,8 +136,8 @@ def test_cloned_repo_object(self, rw_dir):
136136 # Iterating through tree
137137 # [14-test_cloned_repo_object]
138138 tree = repo .tree ()
139- files_dirs = [fd for fd in tree ]
140- files_dirs
139+ files_and_dirs = [entry for entry in tree ]
140+ files_and_dirs
141141
142142 # Output
143143 # [<git.Tree "1d1cbc95a765e42bd46561f197eef01281a97ac0">,
@@ -147,12 +147,11 @@ def test_cloned_repo_object(self, rw_dir):
147147 # ![14-test_cloned_repo_object]
148148
149149 # [15-test_cloned_repo_object]
150- def print_files_from_git (tree , delim = '-' , i = 0 ):
151- files_dirs = [fd for fd in tree ]
152- for fd in files_dirs :
153- print (f'{ delim if i != 0 else "" } | { fd .path } , { fd .type } ' )
154- if fd .type == "tree" :
155- print_files_from_git (fd , delim * 4 , i + 1 )
150+ def print_files_from_git (root , delim = '-' , i = 0 ):
151+ for entry in root :
152+ print (f'{ delim if i != 0 else "" } | { entry .path } , { entry .type } ' )
153+ if entry .type == "tree" :
154+ print_files_from_git (entry , delim * 4 , i + 1 )
156155
157156 # ![15-test_cloned_repo_object]
158157
You can’t perform that action at this time.
0 commit comments