File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,9 @@ def list_files(top_path, log=None):
140140 results = []
141141
142142 for root , dirs , files in os .walk (top_path , followlinks = True ):
143+ # Sort directories and files to ensure they are always processed in the same order
144+ dirs .sort ()
145+ files .sort ()
143146 for file_name in files :
144147 file_path = os .path .join (root , file_name )
145148 relative_path = os .path .relpath (file_path , top_path )
@@ -211,6 +214,9 @@ def yesno_bool(val):
211214
212215def emit_dir_content (base_dir ):
213216 for root , dirs , files in os .walk (base_dir , followlinks = True ):
217+ # Sort directories and files to ensure they are always processed in the same order
218+ dirs .sort ()
219+ files .sort ()
214220 if root != base_dir :
215221 yield os .path .normpath (root )
216222 for name in files :
@@ -596,6 +602,9 @@ def emit_file(fpath, opath):
596602 yield path
597603 else :
598604 for root , dirs , files in os .walk (path , followlinks = True ):
605+ # Sort directories and files to ensure they are always processed in the same order
606+ dirs .sort ()
607+ files .sort ()
599608 o , d = norm_path (path , root )
600609 # log.info('od: %s %s', o, d)
601610 if root != path :
You can’t perform that action at this time.
0 commit comments