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: handle "matching" regions of different lengths, minor cleanup #4522

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

yuja
Copy link
Collaborator

@yuja yuja commented Sep 23, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

lib/src/diff.rs Outdated Show resolved Hide resolved
@yuja yuja marked this pull request as draft September 24, 2024 02:47
yuja added 3 commits October 1, 2024 06:34
…ield

I'll replace offsets with absolute [Range, ..] to support unchanged regions of
different lengths. All fields in UnchangedRange will be ranges.
…lengths

We have two options to achieve "diff --ignore-*-space":
 a. preprocess contents to be diffed, then translate hunk ranges back
 b. add hooks to customize eq and hash functions
I originally thought (a) would be easier, but actually, there aren't many
changes needed to implement (b). And (b) should have a fewer logic errors.

This patch removes assumption that each unchanged region has the same content
length. It won't be true if whitespace characters are ignored.
@yuja yuja force-pushed the push-ponuxwwuoqkv branch from 30677bb to 88ab7eb Compare September 30, 2024 21:42
@yuja yuja marked this pull request as ready for review September 30, 2024 21:43
@yuja yuja merged commit 4f8ae69 into jj-vcs:main Oct 1, 2024
18 checks passed
@yuja yuja deleted the push-ponuxwwuoqkv branch October 1, 2024 12:24
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

Successfully merging this pull request may close these issues.

2 participants