Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect merge #341

Open
doug65536 opened this issue Jan 25, 2022 · 4 comments
Open

Incorrect merge #341

doug65536 opened this issue Jan 25, 2022 · 4 comments

Comments

@doug65536
Copy link

doug65536 commented Jan 25, 2022

JSFiddle repro

What happened to def lambda... in "mine"? It ate it, right?

EDIT: link updated to fix "mine" terminology

@doug65536
Copy link
Author

doug65536 commented Jan 26, 2022

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.

@doug65536
Copy link
Author

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?

@ExplodingCabbage
Copy link
Collaborator

Interesting. Yeah, this is a bug.

@ExplodingCabbage
Copy link
Collaborator

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants