You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was included to avoid situations that could lead to uncommitted changes to be wiped when patch commands are used (note that the patch applier logic also triggers when a install/update event targets either directly or indirectly a package that has patches defined against it).
The way the patches are applied is based on the standard Composer behaviour of reinstalling a package which would mean that a user can potentially lose changes that they have made to the sub-components and their project, so this error/check has been put in place to avoid such unfortunate situations BUT it could also be caused by the dev-versioned package being targeted by some patch (in which case it'd be actually OK to reinstall it -- but there's no sophisticated logic behind the whole check to differentiate between the two situations).
You can force the reset in all such cases by using --force flag while using composer patch:<apply/redo/undo>.
If you'd want this to be the default behaviour on every composer event that includes patches, you can also add the following to your project's package.json:
One thing that could be done here would be to track the fingerprint of the whole code-base of the patched package to determine if changes introduced are from the patches.
Another thing that should be checked for is to see if there's a probability for a situation to occur where there are two patches against one dev-version package where first one introduces the code modifications and second one fails.
From time to time I catch this error while installing composer packages. So what can be a possible reason of this happening? Thanks!
The text was updated successfully, but these errors were encountered: