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

Patch to drupal/core applied twice

Open claudiu-cristea opened this issue 9 years ago • 4 comments
trafficstars

Drupal core is in web/. After applying patch https://www.drupal.org/files/issues/2673628-17.patch (from https://www.drupal.org/node/2673628) the patch correctly applies but I'm getting also a duplicate file in web/core/b/core/modules/system/src/Tests/Update/CustomStorageEntityDefinitionUpdateTest.php. I suspect "b" comes from an incorrect usage of system patch command (missing probably the -p1?) but the patch is correctly applied, the file is also present in the right location.

Note that In my case the patch is applied, not from d.o, but from local filesystem.

Relevant composer.json lines:

  ...
  "require": {
    "composer/installers": "^1.0.20",
    "cweagans/composer-patches": "~1.0",
    ...
    "drupal/core": "8.1.7",
    ...
  }
  ...
  "extra": {
    "installer-paths": {
      "web/core": ["type:drupal-core"],
      ...
    },
    "patches": {
      "drupal/core": {
        ...
        "Ignore custom storage field definition removals/additions @see https://www.drupal.org/node/2673628": "patches/2673628-17.patch"
      },
      ...
    }
    ...
  }
...

claudiu-cristea avatar Jul 23 '16 09:07 claudiu-cristea

I am seeing duplication too, but in two places: 'web/core/b/core' and 'web/core/core'.

The following patch directive:

"patches": {
    "drupal/core": {
        "node/user reference fields": "https://www.drupal.org/files/issues/2447727-184.patch",
        "audio/video file formatters": "https://www.drupal.org/files/issues/file_field_formatters-1174892-63.patch"
    }
}

produces files in 'web/core/b/core/lib', 'web/core/b/core/modules', 'web/core/core/lib', 'web/core/core/modules'.

wellebee avatar Sep 20 '16 18:09 wellebee

This stems from how the plugin tries to figure out the right -p value. I'm not really sure how to make this better, to be honest, but I'll explore some solutions for the 2.x branch.

cweagans avatar Sep 21 '16 01:09 cweagans

You'll be able to specify patch depth per-patch in 2.0.0. See #93 for details on that release.

cweagans avatar Jun 02 '18 06:06 cweagans

For current 1.x, patchLevel should help with patches for drupal/core.

Also, see #178 , #203

john-herreno-ds avatar Apr 07 '21 16:04 john-herreno-ds

main allows you to specify depth on a per-patch basis now. I'll be adding the ability to specify a default per-package in the next day or two.

cweagans avatar Feb 07 '23 20:02 cweagans