Skip to content

Commit 196d3aa

Browse files
bp-devkpdecker
authored andcommitted
Support patches with empty lines
Ignore empty line at end of patch file as it's not really part of the patch
1 parent e24d789 commit 196d3aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/patch/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function parsePatch(uniDiff, options = {}) {
9595
&& diffstr[i + 2].indexOf('@@') === 0) {
9696
break;
9797
}
98-
let operation = diffstr[i].length>0 ? diffstr[i][0] : ' ';
98+
let operation = (diffstr[i].length==0 && i!=diffstr.length-1) ? ' ' : diffstr[i][0];
9999

100100
if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
101101
hunk.lines.push(diffstr[i]);

0 commit comments

Comments
 (0)