Skip to content

Conversation

@cruessler
Copy link
Contributor

This PR is a continuation of #1976. I took the original PR by @holodorum and applied the suggestions I had given in my reviews of his PR. I also added a few tests and adapted some parts to gitoxide’s conventions.

These are the most important changes:

  • a rename from range to ranges that was done so the variable name now corresponds to the type name BlameRanges.
  • the conversion of BlameRanges into an enum, to more idiomatically cover the special case WholeFile.
  • making sure BlameRanges keeps its ranges sorted as that is important for the blame algorithm.

There’s one decision that requires particular attention. When you add a range to a WholeFile, it is turned into a PartialFile containing the given range. This mirrors the difference of git blame vs. git blame -L a,b. The initial version of the PR returned an error instead, but that makes the API less ergonomic, so I decided to make the change.

cruessler and others added 5 commits October 6, 2025 08:56
Co-authored-by: Bart Dubbeldam <bartdubbeldam2000@gmail.com>
Co-authored-by: Bart Dubbeldam <bartdubbeldam2000@gmail.com>
This modification introduces changes to the `BlameRanges` struct,
converting it into an enum to support both `PartialFile` and
`WholeFile`. Internally the ranges in `BlameRanges` are stored as
zero-based exclusive ranges now.

Co-authored-by: Bart Dubbeldam <bartdubbeldam2000@gmail.com>
Co-authored-by: Bart Dubbeldam <bartdubbeldam2000@gmail.com>
The comment was referring to previous versions of the code.
@Byron
Copy link
Member

Byron commented Oct 30, 2025

Did you say this is ready for merging and hanging on me?
Maybe I missed this completely.

@cruessler
Copy link
Contributor Author

Yes! If I remember correctly, nothing is missing from my side (though it has been a couple of weeks since I last touched this PR 😅).

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