From 196d3aa052e89bfe929ed6368b11dc7d011bf911 Mon Sep 17 00:00:00 2001 From: bp-dev Date: Tue, 9 Jan 2018 14:11:45 -0500 Subject: [PATCH] Support patches with empty lines Ignore empty line at end of patch file as it's not really part of the patch --- src/patch/parse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patch/parse.js b/src/patch/parse.js index 42038a94..db023526 100755 --- a/src/patch/parse.js +++ b/src/patch/parse.js @@ -95,7 +95,7 @@ export function parsePatch(uniDiff, options = {}) { && diffstr[i + 2].indexOf('@@') === 0) { break; } - let operation = diffstr[i].length>0 ? diffstr[i][0] : ' '; + let operation = (diffstr[i].length==0 && i!=diffstr.length-1) ? ' ' : diffstr[i][0]; if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]);