io->write("Creating temporary git repo in $path to apply patch", true, IOInterface::VERBOSE); // Create a temporary git repository. $status = $this->executeCommand( '%s -C %s init', $this->patchTool(), $path ); // If we couldn't create the Git repo, bail out. if (!$status) { return false; } // Use the git patcher to apply the patch. $status = parent::apply($patch, $path); // Clean up the git repo. (new Filesystem($this->executor))->removeDirectory($path . '/.git'); return $status; } }