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

diff3 can produce quite unexpected merges #3

Open
wizzard0 opened this issue Nov 19, 2014 · 0 comments
Open

diff3 can produce quite unexpected merges #3

wizzard0 opened this issue Nov 19, 2014 · 0 comments

Comments

@wizzard0
Copy link

Repro:

var x = require("xdiff");
var util = require("util");
var o = {"k":["B","C","D","E"]};
var o2 = JSON.parse(JSON.stringify(o));
var a = {"k":["B","X","X","X","X","D","E","ERROR"]}
var b = {"k":["B","C","D","E"]}
var b2 = {"k":["B","Y","D","E"]}

var m = x.patch(o, x.diff3(a,o,b));
console.log(util.inspect(m));

var m2 = x.patch(o2, x.diff3(a,o2,b2));
console.log(util.inspect(m2));

Expected Output:

{ k: [ 'B', 'X', 'X', 'X', 'X', 'D', 'E', 'ERROR' ] }
{ k: [ 'B', 'X', 'X', 'X', 'X', 'D', 'E', 'ERROR' ] }

Actual Output:

{ k: [ 'B', 'X', 'X', 'X', 'X', 'D', 'E', 'ERROR' ] }
{ k: [ 'B', 'X', 'X', 'X', 'ERROR', 'X', 'D', 'E' ] }

(well, maybe "expected output" could be different, but inserting a "fragment" in the middle of another "fragment" is clearly wrong)

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

No branches or pull requests

1 participant