1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-10 00:42:40 +01:00

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
This commit is contained in:
epriestley 2012-03-05 13:22:04 -08:00
parent ee21b3c661
commit d7b10e4f44

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