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

Patching done on temp folder; replacement on success

Open attisan opened this issue 4 years ago • 1 comments
trafficstars

Though I do know, that patching in production shouldn't be the way to go - it sometimes happens. Could this module be altered in a way, that instead of instantly deleting the packages to be patched, the package is downloaded into a "temp" directory, say by adding a suffix to the folder, the patch is applied and on a clean success the old directory is deleted and the "temp" (patched) is renamed according?

this would drastically reduce trouble in cases where

  • composer takes ages to resolve dependencies (but has already deleted the code-base for it to be "re-installed and re-patched")
  • composer runs into trouble and decides to die due to "reasons"
  • patch applies partially and leaves behind a potential mess (think undefined but referenced classes ...)
  • ... whatever other use cases there are for "safety first"

attisan avatar Jun 23 '21 08:06 attisan

Someone certainly could do that. Just a simple matter of programming :)

cweagans avatar Jun 23 '21 14:06 cweagans

In main, there is now a patches.lock file and patches are cached in the composer cache. The likelihood of this happening if you've tested your patch locally is very low.

cweagans avatar Feb 07 '23 21:02 cweagans