From eecde1ab980a8435def8fc92f9f8b40b9f013dc0 Mon Sep 17 00:00:00 2001 From: Michael Stucki Date: Fri, 13 Jul 2018 13:01:45 +0200 Subject: [PATCH] Fixes #174: Compatibility with older Git versions --- src/Plugin/Patches.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Plugin/Patches.php b/src/Plugin/Patches.php index de98a99c..249ec7e0 100644 --- a/src/Plugin/Patches.php +++ b/src/Plugin/Patches.php @@ -457,6 +457,12 @@ protected function isPatchingEnabled() */ protected function applyPatchWithGit($install_path, $patch_levels, $filename) { + // Do not use git apply unless the install path is itself a git repo + // @see https://stackoverflow.com/a/27283285 + if (!is_dir($install_path . '/.git')) { + return false; + } + foreach ($patch_levels as $patch_level) { if ($this->io->isVerbose()) { $comment = 'Testing ability to patch with git apply.';