Skip to content

Commit 0c9dd6d

Browse files
committed
Allow patchs in diff format
1 parent a3c8d94 commit 0c9dd6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/patch/parse.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export function parsePatch(uniDiff, options = {}) {
99

1010
// Ignore any leading junk
1111
while (i < diffstr.length) {
12-
if ((/^Index:/.test(diffstr[i])) || (/^@@/.test(diffstr[i]))) {
12+
if (/^(Index:|diff -r|@@)/.test(diffstr[i])) {
1313
break;
1414
}
1515
i++;
1616
}
1717

18-
let header = (/^Index: (.*)/.exec(diffstr[i]));
18+
let header = (/^(?:Index:|diff -r (?:\w+)) (.*)/.exec(diffstr[i]));
1919
if (header) {
2020
index.index = header[1];
2121
i++;
@@ -35,7 +35,7 @@ export function parsePatch(uniDiff, options = {}) {
3535
index.hunks = [];
3636

3737
while (i < diffstr.length) {
38-
if (/^Index:/.test(diffstr[i])) {
38+
if (/^(Index:|diff -r)/.test(diffstr[i])) {
3939
break;
4040
} else if (/^@@/.test(diffstr[i])) {
4141
index.hunks.push(parseHunk());

0 commit comments

Comments
 (0)