From d7b10e4f443eb709ce901479fc25debbc83e039a Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 5 Mar 2012 13:22:04 -0800 Subject: [PATCH] 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 --- src/repository/api/base/ArcanistRepositoryAPI.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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())) { -- 2.43.0