Filter-out context-only hunks in our range-diff#2398
Merged
Urgau merged 4 commits intorust-lang:masterfrom May 9, 2026
Merged
Conversation
Kobzol
approved these changes
May 9, 2026
Member
Author
I wouldn't expect you to do it, I didn't examine it in detail my-self. The only different between our version and the one in the crate is that we give |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR filter-out context-only hunks in our range-diff.
We currently only hide-by-default file changes that only have context-only changes, but as described in #2394, a range-diff might have plenty of hunks that only have context changes (ie not a diff line,
+/-).Implementation wise, I had to copy and lighting edit the
UnifiedDiffimplementation fromimara-diffin order to be able to filter-out some hunks.I sadly had to remove the checkbox (not sure it was very useful to begin with) as knowing with lines to show/hide is highly non-trivial for context line as they can be part of the same context for multiple hunks at the same time (each hunk has +- 3 context line).
I also took the opportunity to switch to
gix-imara-diffsince the original crate has had unreleased fixes for several months.Testing link: http://localhost:8000/gh-range-diff/rust-lang/miri/98cb1d3d48fa7c8e97994050bfd69e8f3da2a1a7..3f8007e19b8cac3d08fb07579bde3217c58807e4/e0b3afbdd5362aa348abc6661ed6417d1a21f58c..d811aaf958594156e2ce38365b835c361aa88de9
Fixes #2394
cc @RalfJung