composer-patches icon indicating copy to clipboard operation
composer-patches copied to clipboard

Sort packages in patches section following sort-packages config

Open JPustkuchen opened this issue 4 years ago • 7 comments

Problem:

If you have to handle a lot of patches in large projects or even have to update / diff them on a regular basis, a logical order of the packages patched helps a lot. Currently, the user has to sort the patches by package name himself.

Proposed solution:

It would be very handy to have an option to automatically update the patches order by package name like

"config": {
    "sort-packages": true,
} 

for packages.

Great work, your plugin is one of the very most important for composer ever!

JPustkuchen avatar Nov 22 '20 09:11 JPustkuchen

Some notes:

  1. "sort-packages" is an existing composer config. I guess patches would not require additional config parameter. But that would mean a backward compatibility break, therefore a new major version might be required.
  2. Patch files should never be sorted, only the packages where patches are applied. Sorting patch files can break the patching if multiple patches are defined for the same package.
  3. patches can be in external composer.patches.json file, which might complicate the solution.

Pasqualle avatar Dec 13 '20 11:12 Pasqualle

After thinking about it more, sorting the list of packages where patches will be applied, can break the patching in case patches from dependencies are allowed.

Pasqualle avatar Dec 13 '20 11:12 Pasqualle

Probably not going to do this. The order that patches are applied to a dependency is not something that can just be changed in most cases.

cweagans avatar Feb 07 '23 21:02 cweagans