Skip to content

Commit 2a63083

Browse files
holodorumByron
authored andcommitted
Refactor blamed_file_entry_id
1 parent b756839 commit 2a63083

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Diff for: gix-blame/src/file/function.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,11 @@ pub fn file(
7373

7474
let mut stats = Statistics::default();
7575
let (mut buf, mut buf2, mut buf3) = (Vec::new(), Vec::new(), Vec::new());
76-
let blamed_file_entry_id = find_path_entry_in_commit(
77-
&odb,
78-
&suspect,
79-
file_path,
80-
cache.as_ref(),
81-
&mut buf,
82-
&mut buf2,
83-
&mut stats,
84-
)?
85-
.ok_or_else(|| Error::FileMissing {
76+
let mut file_id = |commit, buf: &mut Vec<u8>, buf2: &mut Vec<u8>| find_path_entry_in_commit(&odb, commit, file_path, cache.as_ref(), buf, buf2, &mut stats)?.ok_or_else(|| Error::FileMissing {
8677
file_path: file_path.to_owned(),
8778
commit_id: suspect,
88-
})?;
79+
});
80+
let blamed_file_entry_id = file_id(&suspect, &mut buf, &mut buf2)?;
8981
let blamed_file_blob = odb.find_blob(&blamed_file_entry_id, &mut buf)?.data.to_vec();
9082
let num_lines_in_blamed = tokens_for_diffing(&blamed_file_blob).tokenize().count() as u32;
9183

0 commit comments

Comments
 (0)