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

Removing projects has no fallbacks #126

Closed
ao2 opened this issue May 24, 2017 · 2 comments
Closed

Removing projects has no fallbacks #126

ao2 opened this issue May 24, 2017 · 2 comments

Comments

@ao2
Copy link

ao2 commented May 24, 2017

Hi,

when a new patch is detected in the main composer.json, composer-patches removes the target project and reinstall it to apply the patches cleanly, e.g.:

...
Removing package drupal/syntaxhighlighter so that it can be re-installed and re-patched.
...

However it happened to me that the removed project was the one I was working on, and I lost some of the work I did.

Is there a way to prevent that? Maybe composer-patches could make a backup of the project before removing it? Or refuse to remove it if there is a .git directory in it?

Maybe this is more of a generic composer issue?

Thanks,
Antonio

@cweagans
Copy link
Owner

cweagans commented Jun 2, 2018

I'm not opposed to making this configurable in 2.0.0. Added to the roadmap (#93)

@cweagans
Copy link
Owner

cweagans commented Feb 7, 2023

main doesn't do this automatically anymore. It's an explicit action.

I would still recommend not working on things in this way though. composer lets you define things like so:

{
[...]
  "repositories": [
    {
      "type": "path",
      "url": "../../../../"
    }
  ],
  "require": {
    "cweagans/composer-patches": "*@dev",
    "cweagans/composer-patches-testrepo": "~1.0"
  },
[...]
}

(example is taken from the tests on main -- the ../../../../ is the path to where composer-patches exists on disk)

When you do a composer install, it will symlink your local repo into place. That way, if the dep is uninstalled, you don't lose your work. It just deletes the symlink.

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