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

Same patch file gathered multiple times #432

Closed
Sweetchuck opened this issue Dec 28, 2022 · 2 comments
Closed

Same patch file gathered multiple times #432

Sweetchuck opened this issue Dec 28, 2022 · 2 comments

Comments

@Sweetchuck
Copy link
Contributor

Sweetchuck commented Dec 28, 2022

When there are two or more dependency which provide the same patch file, but with different description, then then second time the patch file cannot be applied.

Dependency 1

{
  "patches": {
    "a/a": {
      "Desc 01": "https://example.com/a.patch"
    }
  }
}

Dependency 2

{
  "patches": {
    "a/a": {
      "Desc 02": "https://example.com/a.patch"
    }
  }
}

Then the \cweagans\Composer\Patches::gatherPatches gives the following result:

{
  "a/a": {
    "Desc 01": "https://example.com/a.patch",
    "Desc 02": "https://example.com/a.patch"
  }
}

\cweagans\Composer\Util::arrayMergeRecursiveDistinct

@Sweetchuck
Copy link
Contributor Author

This test case is also strange.
When there are two different package and they want to apply two different patches to the same (third) package, but accidentally they use the same key, then only one of the patch will be applied.

// Deep arrays with same keys

@cweagans
Copy link
Owner

cweagans commented Feb 3, 2023

I'm guessing you're using 1.x (and if you're not, you should be at this exact moment). In that case, you can use https://github.com/cweagans/composer-patches#ignoring-patches to disable one of the patches.

The test you're looking at is for 2.x. Gathering patches from dependencies is no longer supported in 2.x. I might add a command to import patches from installed dependencies, but the plugin won't do it automatically anymore.

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

2 participants