]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Set the CWD before applying a git patch
authorGareth Evans <garoevans@gmail.com>
Sat, 28 Sep 2013 13:53:15 +0000 (06:53 -0700)
committerepriestley <git@epriestley.com>
Sat, 28 Sep 2013 13:53:20 +0000 (06:53 -0700)
Summary:
If in a subdirectory, any changes made in a different location
is missed from the patch with no errors from git. The other
option was to run some logic to compare the files being changed.

Test Plan:
Run arc patch from a subdirectory that would miss some files
previously.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran
Maniphest Tasks: T3733

Differential Revision: https://secure.phabricator.com/D7167

src/workflow/ArcanistPatchWorkflow.php

index 907e97f946b45ca53a29a399238225cb56c242bd..ce7b0f11029c684f533d8841154084e8d3b9f649 100644 (file)
@@ -676,9 +676,11 @@ EOTEXT
       $patchfile = new TempFile();
       Filesystem::writeFile($patchfile, $bundle->toGitPatch());
 
-      $err = $repository_api->execPassthru(
-        'apply --index --reject -- %s',
+      $passthru = new PhutilExecPassthru(
+        'git apply --index --reject -- %s',
         $patchfile);
+      $passthru->setCWD($repository_api->getPath());
+      $err = $passthru->execute();
 
       if ($err) {
         echo phutil_console_format(