File tree 1 file changed +7
-8
lines changed
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):
136
136
# Iterating through tree
137
137
# [14-test_cloned_repo_object]
138
138
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
141
141
142
142
# Output
143
143
# [<git.Tree "1d1cbc95a765e42bd46561f197eef01281a97ac0">,
@@ -147,12 +147,11 @@ def test_cloned_repo_object(self, rw_dir):
147
147
# ![14-test_cloned_repo_object]
148
148
149
149
# [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 )
156
155
157
156
# ![15-test_cloned_repo_object]
158
157
You can’t perform that action at this time.
0 commit comments