Summary: A minor bug in the parser prevented it from handling git diffs where an
empty file appears at the end of the diff. Since git appends an extra newline,
we failed to jump into the '$line === null' block.
Test Plan: Ran unit tests. Generated a revision which only deleted an empty
file.
Reviewers: jungejason, nh, tuomaspelkonen, aran
Reviewed By: nh
CC: aran, nh, epriestley
Differential Revision: 998
19 files changed:
// $this->didFailParse("Expected 'index af23f...a98bc' header line.");
} else {
- $line = $this->nextLine();
+ // NOTE: In the git case, where this patch is the last change in the
+ // file, we may have a final terminal newline. Skip over it so that
+ // we'll hit the '$line === null' block below. This is covered by the
+ // 'git-empty-file.gitdiff' test case.
+ $line = $this->nextNonemptyLine();
}
}
$change->getNewProperties()
);
break;
+ case 'git-empty-files.gitdiff':
+ $this->assertEqual(2, count($changes));
+ while ($change = array_shift($changes)) {
+ $this->assertEqual(0, count($change->getHunks()));
+ }
+ break;
case 'git-commit.gitdiff':
$this->assertEqual(1, count($changes));
$change = reset($changes);
--- /dev/null
+diff --git a/empty b/empty
+new file mode 100644
+index 0000000..e69de29
+diff --git a/empty2 b/empty2
+new file mode 100644
+index 0000000..e69de29