Remove extra indirector for blame function

This commit is contained in:
Mattias Granlund 2024-04-20 13:24:33 +02:00
parent 8dd4a92622
commit 2f7b396ab8
2 changed files with 2 additions and 17 deletions

View File

@ -5,7 +5,6 @@ use std::{
};
use anyhow::{Context, Result};
use git2::Blame;
use super::conflicts;
use crate::error::{AnyhowContextExt, Code, ErrorWithContext};
@ -617,19 +616,6 @@ impl Repository {
Err(RemoteError::Auth)
}
pub fn blame(
&self,
path: &path::Path,
min_line: u32,
max_line: u32,
oldest_commit: &git::Oid,
newest_commit: &git::Oid,
) -> Result<Blame, RemoteError> {
Ok(self
.git_repository
.blame(path, min_line, max_line, oldest_commit, newest_commit)?)
}
}
#[derive(Debug, thiserror::Error)]

View File

@ -32,7 +32,6 @@ use crate::{
diff::{self},
Commit, Refname, RemoteRefname,
},
id::Id,
keys,
project_repository::{self, conflicts, LogUntil},
reader, users,
@ -1792,7 +1791,7 @@ fn get_applied_status(
}
for (path, hunks) in base_diffs.clone().into_iter() {
for hunk in hunks {
let blame = project_repository.blame(
let blame = project_repository.git_repository.blame(
&path,
hunk.old_start,
(hunk.old_start + hunk.old_lines).saturating_sub(1),
@ -1804,7 +1803,7 @@ fn get_applied_status(
for blame_hunk in blame.iter() {
let commit = blame_hunk.orig_commit_id();
if git::Oid::from(commit) != *target_sha {
let hash = Hunk::hash(&hunk.diff_lines.as_ref());
let hash = Hunk::hash(hunk.diff_lines.as_ref());
git_hunk_map.insert(hash, branch.id);
break;
}