@@ -10,7 +10,7 @@ use std::{
1010use gix_diff:: blob:: Sink ;
1111use gix_hash:: ObjectId ;
1212use gix_object:: FindExt ;
13- use gix_ref:: { bstr:: BStr , file :: ReferenceExt , store :: WriteReflog } ;
13+ use gix_ref:: bstr:: BStr ;
1414
1515#[ derive( Clone , Copy , Debug , PartialEq ) ]
1616pub enum Offset {
@@ -641,7 +641,12 @@ fn coalesce_blame_entries(lines_blamed: Vec<BlameEntry>) -> Vec<BlameEntry> {
641641}
642642
643643// TODO: do not instantiate anything, get everything passed as argument.
644- pub fn blame_file ( worktree_path : PathBuf , file_path : & BStr ) -> Vec < BlameEntry > {
644+ pub fn blame_file < T : gix_object:: Find + gix_object:: FindHeader > (
645+ odb : T ,
646+ start_id : ObjectId ,
647+ worktree_path : PathBuf ,
648+ file_path : & BStr ,
649+ ) -> Vec < BlameEntry > {
645650 // TODO
646651 // At a high level, what we want to do is the following:
647652 //
@@ -660,20 +665,7 @@ pub fn blame_file(worktree_path: PathBuf, file_path: &BStr) -> Vec<BlameEntry> {
660665 // <---><---><-----><-------><-----><------->
661666 // <---><---><-----><-------><-----><-><-><->
662667
663- let store = gix_ref:: file:: Store :: at (
664- worktree_path. join ( ".git" ) ,
665- gix_ref:: store:: init:: Options {
666- write_reflog : WriteReflog :: Disable ,
667- ..Default :: default ( )
668- } ,
669- ) ;
670- let odb = gix_odb:: at ( worktree_path. join ( ".git/objects" ) ) . unwrap ( ) ;
671-
672- let mut reference = gix_ref:: file:: Store :: find ( & store, "HEAD" ) . unwrap ( ) ;
673-
674- let head_id = reference. peel_to_id_in_place ( & store, & odb) . unwrap ( ) ;
675-
676- let mut traverse = gix_traverse:: commit:: Simple :: new ( Some ( head_id) , & odb) ;
668+ let mut traverse = gix_traverse:: commit:: Simple :: new ( Some ( start_id) , & odb) ;
677669
678670 let git_dir = worktree_path. join ( ".git" ) ;
679671 let index = gix_index:: File :: at ( git_dir. join ( "index" ) , gix_hash:: Kind :: Sha1 , false , Default :: default ( ) ) . unwrap ( ) ;
0 commit comments