mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 10:12:41 +01:00
Fix "empty diff" error in arcanist
Summary: Ref T2296. This error is unreachable right now -- when I fixed all the "\r\n" stuff, we always end up with a nonempty first line for an empty input. Do this test earlier and more explicitly. This results in a less useful error: "expected (some junk) on line 1" instead of "can't parse an empty diff". Test Plan: Tried to parse an empty diff, got a "you can't parse an empty diff" error. Reviewers: btrahan, vrana, codeblock Reviewed By: codeblock CC: aran Maniphest Tasks: T2296 Differential Revision: https://secure.phabricator.com/D4370
This commit is contained in:
parent
a5ddd7ebc0
commit
ea1585d7fa
1 changed files with 4 additions and 4 deletions
|
@ -188,12 +188,12 @@ final class ArcanistDiffParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseDiff($diff) {
|
public function parseDiff($diff) {
|
||||||
$this->didStartParse($diff);
|
if (!strlen(trim($diff))) {
|
||||||
|
throw new Exception("Can't parse an empty diff!");
|
||||||
if ($this->getLine() === null) {
|
|
||||||
$this->didFailParse("Can't parse an empty diff!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->didStartParse($diff);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$patterns = array(
|
$patterns = array(
|
||||||
// This is a normal SVN text change, probably from "svn diff".
|
// This is a normal SVN text change, probably from "svn diff".
|
||||||
|
|
Loading…
Reference in a new issue