jsdiff
jsdiff copied to clipboard
Incorrect merge
What happened to def lambda... in "mine"? It ate it, right?
EDIT: link updated to fix "mine" terminology
I don't know if it is better or not, reduced the repro. Note that "t3" is lost in "mine".
EDIT: fixed fiddle link to not use old "/show" thing.
Is it because I am missing a "fuzz" algorithm when interpreting/applying the merge output, or is that t3 line intended to be in the merge result?
Interesting. Yeah, this is a bug.
Further simplified version (which hints a bit at what's going on - presumably t3
vanishes in part because it isn't included at all in the hunk in the first patch, although that's not a complete explanation yet...):
diff = require('.');
patch1 = 'Index: bla\n' +
'===================================================================\n' +
'--- bla\n' +
'+++ bla\n' +
'@@ -4,6 +4,6 @@\n' +
' t4\n' +
' t5\n' +
' t6\n' +
' \n' +
'-#n\n' +
'+#?-con\n' +
' af\n'
patch2 = 'Index: bla\n' +
'===================================================================\n' +
'--- bla\n' +
'+++ bla\n' +
'@@ -1,9 +1,9 @@\n' +
' t1\n' +
'-t2\n' +
'+t2-mer\n' +
' t3\n' +
' t4\n' +
' t5\n' +
' t6\n' +
' \n' +
'-#n\n' +
'+#n-con\n' +
' af\n'
diff.merge(patch1, patch2)