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
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())) {