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

Diff is working weird in some scenarios? #59

Open
hmarcelodn opened this issue Jul 12, 2022 · 1 comment
Open

Diff is working weird in some scenarios? #59

hmarcelodn opened this issue Jul 12, 2022 · 1 comment

Comments

@hmarcelodn
Copy link

Hello,

We are experiencing a really weird behaviour with the following example:

const Diff3 = require('node-diff3');

const templateA = `
$capitalize($possessive([q#3])) Security Policies and Procedures were adopted as of (Date) by
`;

const templateB = `
$capitalize($possessive([q#3])) Security Policies and Procedures were adopted as of [Date] by

123
`;

const original = `
$capitalize($possessive([q#3])) Security Policies and Procedures were adopted as of (Date) by
`

const diffOutput = Diff3.diff3Merge(templateA, original, templateB, { stringSeparator: '\n' });
console.log(diffOutput[0].ok.join('\n'));
console.log(diffOutput);

My expectation from the code above is to get:

$capitalize($possessive([q#3])) Security Policies and Procedures were adopted as of (Date) by

123

However I am getting:

$capitalize($possessive([q#3])) Security Policies and Procedures were adopted as of [Date] by

123

Notice the parenthesis is not being applied to my [Date] piece. Any clue on what's happening? I am expecting to get a conflict but its not happening.

Thanks in advanced.

@denis-sokolov
Copy link

The behavior seems exactly right to me. Your templateA is unchanged from the original, and your templateB has new parentheses and the number 123. The 3-way merge is then to take templateB and ignore templateA, there is no conflict. Did you perhaps mean to use the different parentheses in the original?

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

2 participants