1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Allow arc diff and similar to run on systems with no git

Summary:
We assume `git` is available now, but should not. Specifically, if a user runs a working copy operation like `arc list` in an SVN working copy without `git` available, they get this error: P707

We interpret git errors very narrowly; be more liberal in how we interpret them. This assumes users working with `git` will have a functional `git`, but this seems like a reasonable assumption and lets us remove some error text matching code.

Test Plan: Changed `git` to `girt`, ran `arc list`, saw a reasonable exception. Changed back to `git`, saw git detected.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: svemir, aran

Differential Revision: https://secure.phabricator.com/D4804
This commit is contained in:
epriestley 2013-02-04 11:34:53 -08:00
parent 8e34e2bd03
commit be73bd8716

View file

@ -288,10 +288,11 @@ abstract class ArcanistRepositoryAPI {
return Filesystem::resolvePath(rtrim($stdout, "\n"), $root);
} catch (CommandException $ex) {
if (preg_match('/^fatal: Not a git repository/', $ex->getStdErr())) {
return null;
}
throw $ex;
// This might be because the $root isn't a Git working copy, or the user
// might not have Git installed at all so the `git` command fails. Assume
// that users trying to work with git working copies will have a working
// `git` binary.
return null;
}
}