1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-23 14:00:55 +01:00

Fix a fatal for git uncommitted changes in new arc projects

Summary:
If you run `arc diff` in a repository which:

  - has uncommitted or untracked changes; and
  - has a .arcconfig with a never-before-seen project ID;
  - we fatal: http://pastebin.com/raw.php?i=ykpfr4MT

This patch is a bit iffy, open to alternatives. The "right" patch is probably an `arcanistproject.query` which behaves more sensibly.

I return array() directly since we'll later create the project.

Test Plan: Ran `arc diff` in a repository with untracked files or uncommitted changes and a new project ID.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D4057
This commit is contained in:
epriestley 2012-12-05 09:20:15 -08:00
parent 209ffba8c0
commit ba1a17ac31

View file

@ -1408,11 +1408,24 @@ abstract class ArcanistBaseWorkflow {
if (!$project_id) {
$this->projectInfo = array();
} else {
try {
$this->projectInfo = $this->getConduit()->callMethodSynchronous(
'arcanist.projectinfo',
array(
'name' => $project_id,
));
} catch (ConduitClientException $ex) {
if ($ex->getErrorCode() != 'ERR-BAD-ARCANIST-PROJECT') {
throw $ex;
}
// TODO: Implement a proper query method that doesn't throw on
// project not found. We just swallow this because some pathways,
// like Git with uncommitted changes in a repository with a new
// project ID, may attempt to access project information before
// the project is created. See T2153.
return array();
}
}
}