Browse Source

Sort vendor/composer/installed.json deterministically

Just like composer.lock, sort installed.json in order of the package
names. This makes it easier to review diffs when this file is changed.
Kunal Mehta 7 years ago
parent
commit
2a38417653
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/Composer/Repository/FilesystemRepository.php

+ 4 - 0
src/Composer/Repository/FilesystemRepository.php

@@ -83,6 +83,10 @@ class FilesystemRepository extends WritableArrayRepository
             $data[] = $dumper->dump($package);
         }
 
+        usort($data, function($a, $b) {
+            return strcmp($a['name'], $b['name']);
+        });
+
         $this->file->write($data);
     }
 }