From: epriestley Date: Mon, 4 Feb 2013 19:34:53 +0000 (-0800) Subject: Allow `arc diff` and similar to run on systems with no `git` X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=be73bd871634f8c7fca0d847064b01daded452b4;p=arcanist.git 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 --- diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php index 4501dc4c..0a170fa7 100644 --- a/src/repository/api/ArcanistRepositoryAPI.php +++ b/src/repository/api/ArcanistRepositoryAPI.php @@ -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; } }