Skip to content

Conversation

cruessler
Copy link
Contributor

This is a PR that reduces noise in gix-blame tests by implementing From<(Range<u32>, ObjectId)> for UnblamedHunk. This implementation allows us to replace UnblamedHunk { range_in_blamed_file: 3..5, suspects: [(suspect, 3..5)].into(), source_file_name: None, } by (3..5, suspect).into() and new_unblamed_hunk(0..5, suspect, Offset::Added(0)) by (0..5, suspect).into(). I think this change significantly increases the signal-to-noise ratio.

In addition to this, we could also implement From<(Range<u32>, (ObjectId, Range<u32>))> for UnblamedHunk or From<(Range<u32>, ObjectId, Offset)> for UnblamedHunk in order to convert places where the range associated with a suspect is not identical to range_in_blamed_file, but the benefit would be smaller. What do you think?

@Byron
Copy link
Member

Byron commented Sep 8, 2025

This is awesome!

Sure, it's a bit less clear what these values mean at first glance, but tests can be expert mode where a thing or two have to be learned in order to write or understand them.

In addition to this, we could also implement From<(Range<u32>, (ObjectId, Range<u32>))> for UnblamedHunk or From<(Range<u32>, ObjectId, Offset)> for UnblamedHunk in order to convert places where the range associated with a suspect is not identical to range_in_blamed_file, but the benefit would be smaller. What do you think?

Go for it :).

@Byron Byron merged commit c78af3c into GitoxideLabs:main Sep 8, 2025
25 checks passed
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