Skip to content

Commit

Permalink
Add switch to $patch_levels for Magento 2 Official Patches
Browse files Browse the repository at this point in the history
Magento is a fairly popular software where composer-patches is especially useful.  Patch files distributed by Magento in some special cases are based in the root directory, containing paths like `a/vendor/magento/module-catalog`.  In cases such as these, if only a single module is referenced in the patch file then a -p4 flag will allow the patch to work as distributed by Magento.
  • Loading branch information
navarr authored Jun 7, 2017
1 parent b3036f2 commit 2ab836b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path,
$patched = FALSE;
// The order here is intentional. p1 is most likely to apply with git apply.
// p0 is next likely. p2 is extremely unlikely, but for some special cases,
// it might be useful.
$patch_levels = array('-p1', '-p0', '-p2');
// it might be useful. p4 is useful for Magento 2 patches
$patch_levels = array('-p1', '-p0', '-p2', '-p4');
foreach ($patch_levels as $patch_level) {
$checked = $this->executeCommand('cd %s && git --git-dir=. apply --check %s %s', $install_path, $patch_level, $filename);
if ($checked) {
Expand Down

0 comments on commit 2ab836b

Please sign in to comment.