Skip to content

Commit fa76de6

Browse files
committed
better performance for gix blame
This really needs caching.
1 parent 16b5058 commit fa76de6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitoxide-core/src/repository/blame.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use std::{ffi::OsStr, path::PathBuf, str::Lines};
22

33
use gix::bstr::BStr;
44

5-
pub fn blame_file(repo: gix::Repository, file: &OsStr, out: impl std::io::Write) -> anyhow::Result<()> {
5+
pub fn blame_file(mut repo: gix::Repository, file: &OsStr, out: impl std::io::Write) -> anyhow::Result<()> {
6+
repo.object_cache_size_if_unset(repo.compute_object_cache_size_for_tree_diffs(&**repo.index_or_empty()?));
7+
68
let suspect = repo.head()?.peel_to_commit_in_place()?;
79
let traverse: Vec<_> = gix::traverse::commit::Simple::new(Some(suspect.id), &repo.objects).collect();
810
let mut resource_cache = repo.diff_resource_cache_for_tree_diff()?;

0 commit comments

Comments
 (0)