From 90935a144d5bec3e1a02018fd7ed0df72bb545b8 Mon Sep 17 00:00:00 2001 From: Mike Karlesky Date: Sat, 18 May 2024 15:06:18 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20from=20Issue=20#860=20an?= =?UTF-8?q?d=20PR=20#777?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove sort that scrambles path collections order - Ensure directory listing behavior --- lib/ceedling/file_path_collection_utils.rb | 5 ++--- lib/ceedling/file_wrapper.rb | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ceedling/file_path_collection_utils.rb b/lib/ceedling/file_path_collection_utils.rb index 7b68cfaa4..ce71878c2 100644 --- a/lib/ceedling/file_path_collection_utils.rb +++ b/lib/ceedling/file_path_collection_utils.rb @@ -84,7 +84,7 @@ def collect_paths(paths) (Pathname.new( path ).relative_path_from( @working_dir_path )).to_s() end - return paths.sort() + return paths end @@ -110,8 +110,7 @@ def revise_filelist(list, revisions) filepaths = [] # Expand path by pattern as needed and add only filepaths to working list - # Note: `sort()` becuase of Github Issue #860 - @file_wrapper.directory_listing( path ).sort.each do |entry| + @file_wrapper.directory_listing( path ).each do |entry| filepaths << File.expand_path( entry ) if !@file_wrapper.directory?( entry ) end diff --git a/lib/ceedling/file_wrapper.rb b/lib/ceedling/file_wrapper.rb index 3872aa838..12326e9f5 100644 --- a/lib/ceedling/file_wrapper.rb +++ b/lib/ceedling/file_wrapper.rb @@ -46,7 +46,9 @@ def dirname(path) end def directory_listing(glob) - return Dir.glob(glob, File::FNM_PATHNAME) # Case insensitive globs + # Note: `sort()` to ensure platform-independent directory listings (Github Issue #860) + # FNM_PATHNAME => Case insensitive globs + return Dir.glob(glob, File::FNM_PATHNAME).sort() end def rm_f(filepath, options={})