Problem/Motivation

Problem:
* Composer workflow with subtree split of project (e.g. drupal core directory)
* Patch workflow e.g. managed by https://github.com/cweagans/composer-patches
* Want to apply a patch from the project that has parts inside and outside the subtree
(If it's only inside the subtree we cann still use patch -p2.)

Proposed resolution

In an ideal world we could tell git-apply or patch to just use the subtree. It looks like there is no such option.
Autogererate subtree splits of patches in some way.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

axel.rutz created an issue. See original summary.

geek-merlin’s picture

geek-merlin’s picture

Issue summary: View changes

To elaborate on an important patch that spans cure subtree and root htaccess: #1269780-99: Remove symlinks option from .htaccess

xl@thinker:~/Downloads/drupal/drupal-core$ git apply -p0 ../drupal-use_symlinksifownermatch_instead_of_followsymlinks-1269780-99.patch
error: a/.htaccess: Datei oder Verzeichnis nicht gefunden
error: a/core/lib/Drupal/Component/PhpStorage/FileStorage.php: Datei oder Verzeichnis nicht gefunden
error: a/core/modules/system/src/Tests/File/HtaccessUnitTest.php: Datei oder Verzeichnis nicht gefunden
error: a/core/vendor/.htaccess: Datei oder Verzeichnis nicht gefunden
xl@thinker:~/Downloads/drupal/drupal-core$ git apply -p1 ../drupal-use_symlinksifownermatch_instead_of_followsymlinks-1269780-99.patch
error: .htaccess: Datei oder Verzeichnis nicht gefunden
error: core/lib/Drupal/Component/PhpStorage/FileStorage.php: Datei oder Verzeichnis nicht gefunden
error: core/modules/system/src/Tests/File/HtaccessUnitTest.php: Datei oder Verzeichnis nicht gefunden
error: core/vendor/.htaccess: Datei oder Verzeichnis nicht gefunden
xl@thinker:~/Downloads/drupal/drupal-core$ git apply -p2 ../drupal-use_symlinksifownermatch_instead_of_followsymlinks-1269780-99.patch
fatal: Dem Kopfbereich von "git diff" fehlen Informationen zum Dateinamen, wenn 2 vorangestellte Teile des Pfades entfernt werden (Zeile 5)

(I attach the subtree split of it just that it has a home.)

geek-merlin’s picture

geek-merlin’s picture

Title: Find a way to apply (partly) apply patches to subtree splits » Find a way to partly apply patches to subtree splits

Here's a sed recipe to massage a patch before applying. Implementing something like this looks like the way to go.
http://stackoverflow.com/a/19328727/606859

geek-merlin’s picture

Note: there seems to be diff parse code in core.

cweagans’s picture

I'd be happy to add this functionality to cweagans/composer-patches if you happen to find a good way to do it. Not sure why this issue is open in the d.o infrastructure queue though.

mlhess’s picture

Status: Active » Closed (won't fix)

This does not seem to be an infra issue.