-
Notifications
You must be signed in to change notification settings - Fork 22
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
Question: How to remove a patch properly? #42
Comments
Yes, i tried to fix the patch-set to another version of the package but it did not work - i think it still tried to "rollback" the applied patches because they existed in installed.json. |
maybe @copitz can shed some light on it. |
Another problem regarding this issue: you cant work with branches where you need a patch in branch-a, then switch to branch-b (where no patch is needed and the patch file does not exist) and do a composer install because the patch file is missing and cant be rolled back. This is a major issue (!). My only workaround is to delete the "vendor/composer/installed.json". If it is necessary to still have access to the patch file even if it is not required anymore, the patch file (contents) need to be persisted in the current composer state. You should probably add the contents of the patch file to installed.json and pass the string to the stdin of the patch tool. That way you can always rollback installed patches, even if the patch-files only exist in another branch or have been deleted. |
I used composer-patches-plugin to apply some patches to a package (local patch files) and that worked as expected. Thanks so far!
My patches got merged into the package and i don't need them anymore. So i increased the packages version number, patch-package version number, removed the required patches ran composer update (deleted the .patch files too). I finally checked in the composer.lock file to make all changes fixed for deployment.
Today i wanted to update a remote installation - i merged the project source which contains the composer.lock file. When i run composer install, i get the following error:
The "patches/{package}/4b4636293ac6d46e171eaae8e64ae50ce2cd0b29.patch" file could not be downloaded: failed to open stream: No such file or directory
But the patch is not required anymore - so why does composer-patches-plugin need the .patch file?
As a workaround i can delete the local package and run composer install - this will work as expected.
The "problem" seems to be caused by the contents of "installed.json" which contained the patch-file URLs, which did not exist anymore because they are not required in the version defined in composer.lock.
So, what is the "correct" way? Simply keep the patch files in the vcs?
IMO this is not very intuitive nor logical, it may be better to store a copy of the applied patches in some local cache directory (package directory or vendor/composer or even as string value inside installed.json). That way it would be more stable and patch files could be altered as well (i guess changing a patch could also be a problem).
The text was updated successfully, but these errors were encountered: