From: epriestley Date: Mon, 5 Mar 2012 21:22:04 +0000 (-0800) Subject: Make git repo discovery work on Windows X-Git-Tag: conduit-4~123 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=d7b10e4f443eb709ce901479fc25debbc83e039a;p=arcanist.git Make git repo discovery work on Windows 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 --- diff --git a/src/repository/api/base/ArcanistRepositoryAPI.php b/src/repository/api/base/ArcanistRepositoryAPI.php index 19eb526f..ed7ab1d3 100644 --- a/src/repository/api/base/ArcanistRepositoryAPI.php +++ b/src/repository/api/base/ArcanistRepositoryAPI.php @@ -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())) {