1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Fix parsing of git diff when diff.mnemonicprefix=true

Test Plan:
Go to /differential/diff/create and try to upload a patch that was created with
`git diff` when diff.mnemonicprefix was set to true.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1022
This commit is contained in:
Marek Sapota 2011-10-19 15:27:42 -07:00
parent ab50afe583
commit f67401daa4
3 changed files with 14 additions and 1 deletions

View file

@ -204,7 +204,7 @@ class ArcanistDiffParser {
// This is a git commit message, probably from "git show".
'(?P<type>commit) (?P<hash>[a-f0-9]+)',
// This is a git diff, probably from "git show" or "git diff".
'(?P<type>diff --git) a/(?P<old>.+) b/(?P<cur>.+)',
'(?P<type>diff --git) [abicwo12]/(?P<old>.+) [abicwo12]/(?P<cur>.+)',
// This is a unified diff, probably from "diff -u" or synthetic diffing.
'(?P<type>---) (?P<old>.+)\s+\d{4}-\d{2}-\d{2}.*',
'(?P<binary>Binary) files '.

View file

@ -418,6 +418,12 @@ EOTEXT
$this->assertEqual(0, count($change->getHunks()));
}
break;
case 'git-mnemonicprefix.gitdiff':
// Check parsing of diffs created with `diff.mnemonicprefix`
// configuration option set to `true`.
$this->assertEqual(1, count($changes));
$this->assertEqual(1, count(reset($changes)->getHunks()));
break;
case 'git-commit.gitdiff':
$this->assertEqual(1, count($changes));
$change = reset($changes);

View file

@ -0,0 +1,7 @@
diff --git i/FILE w/FILE
index e8b5482..2a42638 100644
--- i/FILE
+++ w/FILE
@@ -1 +1,2 @@
TEXT
+MORE TEXT