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 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:
range
toranges
that was done so the variable name now corresponds to the type nameBlameRanges
.BlameRanges
into an enum, to more idiomatically cover the special caseWholeFile
.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 aPartialFile
containing the given range. This mirrors the difference ofgit 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.