Skip to content

Commit 10aaabb

Browse files
bp-devkpdecker
authored andcommitted
Support patches with empty lines
Code styling
1 parent 196d3aa commit 10aaabb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/patch/apply.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export function applyPatch(source, uniDiff, options = {}) {
3434
function hunkFits(hunk, toPos) {
3535
for (let j = 0; j < hunk.lines.length; j++) {
3636
let line = hunk.lines[j],
37-
operation = line.length>0 ? line[0] : ' ',
38-
content = line.length>0 ? line.substr(1) : line;
37+
operation = (line.length > 0 ? line[0] : ' '),
38+
content = (line.length > 0 ? line.substr(1) : line);
3939

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

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

9898
if (operation === ' ') {

0 commit comments

Comments
 (0)