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

Can you please explain the Merger.determineConflict function in more details? #3

Open
kuddai opened this issue Aug 8, 2023 · 0 comments

Comments

@kuddai
Copy link

kuddai commented Aug 8, 2023

We have a merge bug in our code, given the following example
`
const strBase = '{"enabled":false}';
const strLeft = '{"enabled":true,"other":1}';
const strRight = '{"enabled":true}';
const merged = merge(strLeft, strBase, strRight);
assert.equal(merged.conflict, false,
'has no merge conflicts');

assert.equal(merged.joinedResults(), strLeft);

`

Output
actual: > {"enabled":truetrue,"other":1} expected: > {"enabled":true,"other":1}

This error steems from this line
https://github.com/movableink/three-way-merge/blob/master/src/merger.ts#L69

As multiple intersected ranges from right are taken into final result. In our case the same 'true' token is taken several times from right array.

Possible solution
#4

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