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

Fix "arc lint" when HEAD has been reverted in the working copy

Summary:
If a user reverts HEAD in the index or working copy, "git diff" shows no changes
and we explode.

Instead, we should simply return no changes; the rest of the lint pipeline
accommodates this correctly.

Test Plan: Reverted HEAD in a working copy, ran "arc lint", got an error.
Applied patch, ran "arc lint", got accurate lint.

Reviewers: Koolvin, btrahan

Reviewed By: Koolvin

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1729
This commit is contained in:
epriestley 2012-02-29 12:18:46 -08:00
parent b3a70ac206
commit f9a7cb225e
2 changed files with 6 additions and 0 deletions

View file

@ -581,6 +581,9 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
public function getAllLocalChanges() {
$diff = $this->getFullGitDiff();
if (!strlen(trim($diff))) {
return array();
}
$parser = new ArcanistDiffParser();
return $parser->parseDiff($diff);
}

View file

@ -362,6 +362,9 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
public function getAllLocalChanges() {
$diff = $this->getFullMercurialDiff();
if (!strlen(trim($diff))) {
return array();
}
$parser = new ArcanistDiffParser();
return $parser->parseDiff($diff);
}