Repository navigation
Support for multiple blame ranges - #1973
Sebastian Thiel (Byron) merged 4 commits into
Conversation
93bb148 to
ead0dca
Compare
This update replaces single-range handling with the `BlameRanges` type, allowing multiple 1-based inclusive line ranges to be specified for blame operations. It hides some of the implementation details of the range logic, prepares for compatibility with `git` behavior, and adds tests to validate multi-range scenarios.
…> -L <other-range> ...` Update the blame subcommand to handle multiple line ranges. This allows specifying multiple `-L` options similar to the usage of git.
ead0dca to
d4461e7
Compare
Byron
left a comment
There was a problem hiding this comment.
Thanks so much, this looks great!
Please note that I did refactor the commits to properly indicate breakage with conventional commits, and there are some other refactors too which you might find interesting.
Also CC Christoph Rüßler (@cruessler) just in case he'd like to see other changes in a follow-up, the reason I merge it already is that it's implemented very non-invasively without basically no changes to the algorithm itself.
|
Wow that was quick! And thank you, there are some insightful refactors and updates :) |
|
Bart Dubbeldam (@holodorum) Sebastian Thiel (@Byron) Just a couple of minor observations, some possibly nitpicky, so feel free to ignore. :-)
Apart from that, I think this is already a great addition! |
|
Also, I feel there’s a certain contradiction in calling the method |
|
That are some good suggestions, thanks Christoph Rüßler (@cruessler). |
|
|
|
Apologies for being so merge-happy 😅, next time I will wait for your review. |
|
Sebastian Thiel (@Byron) No worries! I think we can address all comments in a follow-up PR as you suggest. |
This PR adds support for multiple ranges to blame instead of a single-range. This is compatible with
git's behavior. Using git it's possible to blame multiple ranges as follows:This results in a blame of lines 1-3 in
example.rs. After this update we are able to run the same command usinggix!Initially I tried implementing this without the refactoring to a
BlameRangestype. However, it became messy quickly because the ranges had the typeOption<Vec<std::ops::Range<u32>>>type. WithBlameRangesthe complexity is quite comprehensible I feel.A possible improvement could be to add an enum that signals whether the ranges are
zero_basedorone_based.