Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort packages in patches section following sort-packages config #341

Open
JPustkuchen opened this issue Nov 22, 2020 · 7 comments
Open

Sort packages in patches section following sort-packages config #341

JPustkuchen opened this issue Nov 22, 2020 · 7 comments

Comments

@JPustkuchen
Copy link

JPustkuchen commented Nov 22, 2020

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!

@Pasqualle
Copy link

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

This comment has been minimized.

@cweagans
Copy link
Owner

cweagans commented Feb 7, 2023

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 cweagans closed this as completed Feb 7, 2023
@leymannx
Copy link

leymannx commented Jan 25, 2024

@cweagans @Pasqualle – This issue is not about the order of patches but about the order of packages in the patches section. Same as the order of packages in the require section. In a project with lots of patches having to adjust this section, alphabetically ordered packages help a lot.

@Pasqualle
Copy link

Yes, I agree, packages should be sorted automatically, same as composer does it.
Sorry if my comment was misleading. I just tried to explain the problem with "sort-patches" word in the issue title.

Please re-open as the rejection reason is invalid. Packages can (and should) be sorted.

@leymannx
Copy link

@JPustkuchen – Can you maybe rephrase the title? Something like "Sort packages in patches section following sort-packages config" or similar?

@JPustkuchen JPustkuchen changed the title Feature request: Add "sort-patches" option Sort packages in patches section following sort-packages config Jan 25, 2024
@cweagans cweagans reopened this Feb 21, 2024
@cweagans
Copy link
Owner

I don't have time to work on this, but PRs are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants