]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Make git repo discovery work on Windows
authorepriestley <git@epriestley.com>
Mon, 5 Mar 2012 21:22:04 +0000 (13:22 -0800)
committerepriestley <git@epriestley.com>
Mon, 5 Mar 2012 21:22:04 +0000 (13:22 -0800)
Summary: This use of "(cd ..)" is outside of the RepositoryAPI proper (it's when we're trying to figure out which VCS a directory uses) and explodes on Windows.

Test Plan: @koolvin applied this patch manually and got farther than before.

Reviewers: btrahan, Koolvin, jungejason

Reviewed By: jungejason

CC: aran, epriestley
Maniphest Tasks: T124

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

src/repository/api/base/ArcanistRepositoryAPI.php

index 19eb526f984efb295338c4031380a69ff6ab8e31..ed7ab1d32cb1bf05d5ca98949ccb73f2409acbea 100644 (file)
@@ -133,9 +133,12 @@ abstract class ArcanistRepositoryAPI {
 
   private static function discoverGitBaseDirectory($root) {
     try {
-      list($stdout) = execx(
-        '(cd %s; git rev-parse --show-cdup)',
-        $root);
+
+      // NOTE: This awkward construction is to make sure things work on Windows.
+      $future = new ExecFuture('git rev-parse --show-cdup');
+      $future->setCWD($root);
+      list($stdout) = $future->resolvex();
+
       return Filesystem::resolvePath(rtrim($stdout, "\n"), $root);
     } catch (CommandException $ex) {
       if (preg_match('/^fatal: Not a git repository/', $ex->getStdErr())) {