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:
parent
b3a70ac206
commit
f9a7cb225e
2 changed files with 6 additions and 0 deletions
|
@ -581,6 +581,9 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
|
|
||||||
public function getAllLocalChanges() {
|
public function getAllLocalChanges() {
|
||||||
$diff = $this->getFullGitDiff();
|
$diff = $this->getFullGitDiff();
|
||||||
|
if (!strlen(trim($diff))) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$parser = new ArcanistDiffParser();
|
$parser = new ArcanistDiffParser();
|
||||||
return $parser->parseDiff($diff);
|
return $parser->parseDiff($diff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,6 +362,9 @@ final class ArcanistMercurialAPI extends ArcanistRepositoryAPI {
|
||||||
|
|
||||||
public function getAllLocalChanges() {
|
public function getAllLocalChanges() {
|
||||||
$diff = $this->getFullMercurialDiff();
|
$diff = $this->getFullMercurialDiff();
|
||||||
|
if (!strlen(trim($diff))) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
$parser = new ArcanistDiffParser();
|
$parser = new ArcanistDiffParser();
|
||||||
return $parser->parseDiff($diff);
|
return $parser->parseDiff($diff);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue