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] [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',