Skip to content

Commit

Permalink
Support patches with empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
bp-dev authored and kpdecker committed Mar 5, 2018
1 parent fb0f208 commit 8616a02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/patch/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function applyPatch(source, uniDiff, options = {}) {
function hunkFits(hunk, toPos) {
for (let j = 0; j < hunk.lines.length; j++) {
let line = hunk.lines[j],
operation = line[0],
content = line.substr(1);
operation = line.length>0 ? line[0] : ' ',
content = line.length>0 ? line.substr(1) : line;

if (operation === ' ' || operation === '-') {
// Context sanity check
Expand Down

0 comments on commit 8616a02

Please sign in to comment.