Skip to content

Merge fails for large files #2

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

Open
michael-bieniosek opened this issue Jan 13, 2025 · 2 comments
Open

Merge fails for large files #2

michael-bieniosek opened this issue Jan 13, 2025 · 2 comments

Comments

@michael-bieniosek
Copy link

I was testing merging on a very large file (260k lines) and hit a panic here: https://github.com/nasdf/diff3/blob/main/diff3.go#L131

panic: runtime error: index out of range [157894] with length 155846

After a bit of inspection, I think the issue is that you're calling int(r) instead of diffmatchpatch.runeToInt(r), as DiffCharsToLines does it. From looking at code for runeToInt/intToRune it seems like this could happen with much smaller file size than 100k+ lines.

@nasdf
Copy link
Owner

nasdf commented Jan 15, 2025

@michael-bieniosek Thank you for the detailed issue description. Are you able to provide an example of a failing input?

@michael-bieniosek
Copy link
Author

I was testing with the sqlite amalgamation available here: https://www.sqlite.org/amalgamation.html -- I just made a few random minor changes in two independent copies, then called Diff3 back to the original file.

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