From a48afcd79012cbbe8f47c8ec8e644a7dc60b4866 Mon Sep 17 00:00:00 2001 From: func0der <529819+func0der@users.noreply.github.com> Date: Wed, 10 Nov 2021 15:23:39 +0100 Subject: [PATCH 1/3] [add_sorting_to_archiving] Add natural sorting to ArchivableFilesFinder. --- .../Archiver/ArchivableFilesFinder.php | 3 ++- .../Archiver/ArchivableFilesFinderTest.php | 26 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Composer/Package/Archiver/ArchivableFilesFinder.php b/src/Composer/Package/Archiver/ArchivableFilesFinder.php index 96459f872..b1045720d 100644 --- a/src/Composer/Package/Archiver/ArchivableFilesFinder.php +++ b/src/Composer/Package/Archiver/ArchivableFilesFinder.php @@ -84,7 +84,8 @@ class ArchivableFilesFinder extends \FilterIterator ->in($sources) ->filter($filter) ->ignoreVCS(true) - ->ignoreDotFiles(false); + ->ignoreDotFiles(false) + ->sortByName(true); parent::__construct($this->finder->getIterator()); } diff --git a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php index 90db564fa..7392634a7 100644 --- a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php @@ -48,36 +48,36 @@ class ArchivableFilesFinderTest extends TestCase 'A/prefixD.foo', 'A/prefixE.foo', 'A/prefixF.foo', - 'B/sub/prefixA.foo', - 'B/sub/prefixB.foo', - 'B/sub/prefixC.foo', - 'B/sub/prefixD.foo', - 'B/sub/prefixE.foo', - 'B/sub/prefixF.foo', 'C/prefixA.foo', 'C/prefixB.foo', 'C/prefixC.foo', 'C/prefixD.foo', 'C/prefixE.foo', 'C/prefixF.foo', - 'D/prefixA', - 'D/prefixB', - 'D/prefixC', - 'D/prefixD', - 'D/prefixE', - 'D/prefixF', + 'B/sub/prefixA.foo', + 'B/sub/prefixB.foo', + 'B/sub/prefixC.foo', + 'B/sub/prefixD.foo', + 'B/sub/prefixE.foo', + 'B/sub/prefixF.foo', 'E/subtestA.foo', 'F/subtestA.foo', 'G/subtestA.foo', 'H/subtestA.foo', + 'D/prefixD', + 'D/prefixA', + 'D/prefixB', + 'D/prefixC', + 'D/prefixE', + 'D/prefixF', 'I/J/subtestA.foo', - 'K/dirJ/subtestA.foo', 'toplevelA.foo', 'toplevelB.foo', 'prefixA.foo', 'prefixB.foo', 'prefixC.foo', 'prefixD.foo', + 'K/dirJ/subtestA.foo', 'prefixE.foo', 'prefixF.foo', 'parameters.yml', From 5fb4286550cd714d8cf1951847a471bf8fc730c4 Mon Sep 17 00:00:00 2001 From: func0der <529819+func0der@users.noreply.github.com> Date: Wed, 10 Nov 2021 15:30:18 +0100 Subject: [PATCH 2/3] [add_sorting_to_archiving] Revert changes to test, because they were pointless. --- .../Archiver/ArchivableFilesFinderTest.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php index 7392634a7..90db564fa 100644 --- a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php @@ -48,36 +48,36 @@ class ArchivableFilesFinderTest extends TestCase 'A/prefixD.foo', 'A/prefixE.foo', 'A/prefixF.foo', - 'C/prefixA.foo', - 'C/prefixB.foo', - 'C/prefixC.foo', - 'C/prefixD.foo', - 'C/prefixE.foo', - 'C/prefixF.foo', 'B/sub/prefixA.foo', 'B/sub/prefixB.foo', 'B/sub/prefixC.foo', 'B/sub/prefixD.foo', 'B/sub/prefixE.foo', 'B/sub/prefixF.foo', + 'C/prefixA.foo', + 'C/prefixB.foo', + 'C/prefixC.foo', + 'C/prefixD.foo', + 'C/prefixE.foo', + 'C/prefixF.foo', + 'D/prefixA', + 'D/prefixB', + 'D/prefixC', + 'D/prefixD', + 'D/prefixE', + 'D/prefixF', 'E/subtestA.foo', 'F/subtestA.foo', 'G/subtestA.foo', 'H/subtestA.foo', - 'D/prefixD', - 'D/prefixA', - 'D/prefixB', - 'D/prefixC', - 'D/prefixE', - 'D/prefixF', 'I/J/subtestA.foo', + 'K/dirJ/subtestA.foo', 'toplevelA.foo', 'toplevelB.foo', 'prefixA.foo', 'prefixB.foo', 'prefixC.foo', 'prefixD.foo', - 'K/dirJ/subtestA.foo', 'prefixE.foo', 'prefixF.foo', 'parameters.yml', From 41a0c660b160c588c8502490e44b45e9563e9d40 Mon Sep 17 00:00:00 2001 From: func0der <529819+func0der@users.noreply.github.com> Date: Wed, 10 Nov 2021 15:39:50 +0100 Subject: [PATCH 3/3] [add_sorting_to_archiving] Do not use natural sorting, cause of minimum required versions. --- src/Composer/Package/Archiver/ArchivableFilesFinder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Package/Archiver/ArchivableFilesFinder.php b/src/Composer/Package/Archiver/ArchivableFilesFinder.php index b1045720d..128043797 100644 --- a/src/Composer/Package/Archiver/ArchivableFilesFinder.php +++ b/src/Composer/Package/Archiver/ArchivableFilesFinder.php @@ -85,7 +85,7 @@ class ArchivableFilesFinder extends \FilterIterator ->filter($filter) ->ignoreVCS(true) ->ignoreDotFiles(false) - ->sortByName(true); + ->sortByName(); parent::__construct($this->finder->getIterator()); }