Skip to content

Commit

Permalink
Support patches with empty lines
Browse files Browse the repository at this point in the history
Code styling
  • Loading branch information
bp-dev authored and kpdecker committed Mar 5, 2018
1 parent 196d3aa commit 10aaabb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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.length>0 ? line[0] : ' ',
content = line.length>0 ? line.substr(1) : line;
operation = (line.length > 0 ? line[0] : ' '),
content = (line.length > 0 ? line.substr(1) : line);

if (operation === ' ' || operation === '-') {
// Context sanity check
Expand Down Expand Up @@ -91,8 +91,8 @@ export function applyPatch(source, uniDiff, options = {}) {

for (let j = 0; j < hunk.lines.length; j++) {
let line = hunk.lines[j],
operation = line.length>0 ? line[0] : ' ',
content = line.length>0 ? line.substr(1) : line,
operation = (line.length > 0 ? line[0] : ' '),
content = (line.length > 0 ? line.substr(1) : line),
delimiter = hunk.linedelimiters[j];

if (operation === ' ') {
Expand Down

0 comments on commit 10aaabb

Please sign in to comment.