Skip to content

Existing files are not overwritten when directory is copied with CopyFromPackage #755

@mnocon

Description

@mnocon

Hi!

I believe there's an issue with how copy-from-package works in recipes when directory is copied.

Given following recipe:

{
      "copy-from-package": {
        "testSourceDir/": "testTargetDir/",
      }
}

Once files exist in testTargetDir they will never be updated, even when --force is used when running recipes.

The behaviour I'd expect is as follows:

  1. When running composer symfony:recipes:install <package> without --force the files are not overwritten (their state is not updated).
  2. When running composer symfony:recipes:install <package> with --force the files are overwritten (their state is updated).

I believe this behaviour (overwriting existing files when force is used) is consistent with what's written here: https://symfony.com/doc/current/setup/upgrade_major.html#updating-recipes

Instead, the updates process re-installs the latest version of the recipe which means that your custom code will be overridden completely. After updating a recipe, you need to carefully choose which changes you want, and undo the rest.

I've created a PR here: #756

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions