diff --git a/src/diff-parser.js b/src/diff-parser.js index 5b047e2..9052e46 100644 --- a/src/diff-parser.js +++ b/src/diff-parser.js @@ -455,7 +455,7 @@ * You proberly do not want to see the second record. So will provide an `ignoreSvnPropertyChange` option to do that for you. */ function dropSvnPropertyChangeFiles(files) { - const GIT_BINNARY_HEADER = 'GIT binary patch'; + const GIT_BINARY_HEADER = 'GIT binary patch'; const PROPERTY_CHANGE_HEADER = 'Property changes on:'; var ret = []; for (var i = 0; i < files.length - 1; i++) { @@ -464,7 +464,7 @@ ret.push(file); if (file.blocks.length > 0 && - utils.startsWith(file.blocks[0].header, GIT_BINNARY_HEADER) && + utils.startsWith(file.blocks[0].header, GIT_BINARY_HEADER) && nextFile.blocks.length > 0 && utils.startsWith(nextFile.blocks[0].header, PROPERTY_CHANGE_HEADER) && file.name === nextFile.name && diff --git a/test/diff-parser-tests.js b/test/diff-parser-tests.js index b910868..5dd444e 100644 --- a/test/diff-parser-tests.js +++ b/test/diff-parser-tests.js @@ -728,5 +728,45 @@ describe('DiffParser', function() { assert.deepEqual(linesContent, [' function foo() {', '-var bar = "Whoops!";', '+var baz = "Whoops!";', ' }', ' ']); }); + + it('should parse `svn diff --git` content', function() { + var diff = + 'Index: color_doc.docx\n' + + '===================================================================\n' + + 'diff --git a/color_doc.docx b/color_doc.docx\n' + + 'new file mode 10644\n' + + 'GIT binary patch\n' + + 'literal 296291\n' + + 'zc%1CHV|b>|mmvJaPteH|b!;ac+w9n8$F^;E+_5|E*jC3@$F^-JoBsW0W@mS2->>`O\n' + + ' \n' + + 'literal 0\n' + + 'Hc$@