Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gix-blame/src/file/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ fn coalesce_blame_entries(lines_blamed: Vec<BlameEntry>) -> Vec<BlameEntry> {
// As of 2024-09-19, the check below only is in `git`, but not in `libgit2`.
&& previous_source_range.end == current_source_range.start
{
// let combined_range =
let coalesced_entry = BlameEntry {
start_in_blamed_file: previous_blamed_range.start as u32,
start_in_source_file: previous_source_range.start as u32,
Expand Down
18 changes: 6 additions & 12 deletions gix-blame/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,8 @@ fn process_changes(

impl UnblamedHunk {
fn shift_by(mut self, suspect: ObjectId, offset: Offset) -> Self {
if let Some(position) = self.suspects.iter().position(|entry| entry.0 == suspect) {
if let Some((_, ref mut range_in_suspect)) = self.suspects.get_mut(position) {
*range_in_suspect = range_in_suspect.shift_by(offset);
}
if let Some(entry) = self.suspects.iter_mut().find(|entry| entry.0 == suspect) {
entry.1 = entry.1.shift_by(offset);
}
self
}
Expand Down Expand Up @@ -407,20 +405,16 @@ impl UnblamedHunk {
/// This is like [`Self::pass_blame()`], but easier to use in places where the 'passing' is
/// done 'inline'.
fn passed_blame(mut self, from: ObjectId, to: ObjectId) -> Self {
if let Some(position) = self.suspects.iter().position(|entry| entry.0 == from) {
if let Some((ref mut commit_id, _)) = self.suspects.get_mut(position) {
*commit_id = to;
}
if let Some(entry) = self.suspects.iter_mut().find(|entry| entry.0 == from) {
entry.0 = to;
}
self
}

/// Transfer all ranges from the commit at `from` to the commit at `to`.
fn pass_blame(&mut self, from: ObjectId, to: ObjectId) {
if let Some(position) = self.suspects.iter().position(|entry| entry.0 == from) {
if let Some((ref mut commit_id, _)) = self.suspects.get_mut(position) {
*commit_id = to;
}
if let Some(entry) = self.suspects.iter_mut().find(|entry| entry.0 == from) {
entry.0 = to;
}
}

Expand Down
Loading