diff --git a/src/parser/diff/ArcanistDiffParser.php b/src/parser/diff/ArcanistDiffParser.php index dfd8fda9..f09ee484 100644 --- a/src/parser/diff/ArcanistDiffParser.php +++ b/src/parser/diff/ArcanistDiffParser.php @@ -204,7 +204,7 @@ class ArcanistDiffParser { // This is a git commit message, probably from "git show". '(?Pcommit) (?P[a-f0-9]+)', // This is a git diff, probably from "git show" or "git diff". - '(?Pdiff --git) a/(?P.+) b/(?P.+)', + '(?Pdiff --git) [abicwo12]/(?P.+) [abicwo12]/(?P.+)', // This is a unified diff, probably from "diff -u" or synthetic diffing. '(?P---) (?P.+)\s+\d{4}-\d{2}-\d{2}.*', '(?PBinary) files '. diff --git a/src/parser/diff/__tests__/ArcanistDiffParserTestCase.php b/src/parser/diff/__tests__/ArcanistDiffParserTestCase.php index 7e1fdc31..2af1e63b 100644 --- a/src/parser/diff/__tests__/ArcanistDiffParserTestCase.php +++ b/src/parser/diff/__tests__/ArcanistDiffParserTestCase.php @@ -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); diff --git a/src/parser/diff/__tests__/data/git-mnemonicprefix.gitdiff b/src/parser/diff/__tests__/data/git-mnemonicprefix.gitdiff new file mode 100644 index 00000000..36deb9ca --- /dev/null +++ b/src/parser/diff/__tests__/data/git-mnemonicprefix.gitdiff @@ -0,0 +1,7 @@ +diff --git i/FILE w/FILE +index e8b5482..2a42638 100644 +--- i/FILE ++++ w/FILE +@@ -1 +1,2 @@ + TEXT ++MORE TEXT