@@ -4,6 +4,10 @@ use gix_blame::BlameRanges;
44use gix_hash:: ObjectId ;
55use gix_object:: bstr;
66
7+ fn fixture_hash_kind ( ) -> gix_hash:: Kind {
8+ gix_testtools:: hash_kind_from_env ( ) . unwrap_or_default ( )
9+ }
10+
711struct Baseline < ' a > {
812 lines : bstr:: Lines < ' a > ,
913 filenames : BTreeMap < ObjectId , bstr:: BString > ,
@@ -16,7 +20,7 @@ mod baseline {
1620 use gix_hash:: ObjectId ;
1721 use gix_ref:: bstr:: ByteSlice ;
1822
19- use super :: Baseline ;
23+ use super :: { fixture_hash_kind , Baseline } ;
2024
2125 // These fields are used by `git` in its porcelain output.
2226 const HEADER_FIELDS : [ & str ; 12 ] = [
@@ -73,7 +77,7 @@ mod baseline {
7377
7478 fn next ( & mut self ) -> Option < Self :: Item > {
7579 let mut ranges = None ;
76- let mut commit_id = gix_hash :: Kind :: Sha1 . null ( ) ;
80+ let mut commit_id = fixture_hash_kind ( ) . null ( ) ;
7781 let mut skip_lines: u32 = 0 ;
7882 let mut source_file_name: Option < gix_object:: bstr:: BString > = None ;
7983
@@ -155,14 +159,23 @@ impl Fixture {
155159 fn for_worktree_path ( worktree_path : PathBuf ) -> gix_testtools:: Result < Fixture > {
156160 use gix_ref:: store:: WriteReflog ;
157161
162+ let object_hash = fixture_hash_kind ( ) ;
158163 let store = gix_ref:: file:: Store :: at (
159164 worktree_path. join ( ".git" ) ,
160165 gix_ref:: store:: init:: Options {
161166 write_reflog : WriteReflog :: Disable ,
167+ object_hash,
162168 ..Default :: default ( )
163169 } ,
164170 ) ;
165- let odb = gix_odb:: at ( worktree_path. join ( ".git/objects" ) ) ?;
171+ let odb = gix_odb:: at_opts (
172+ worktree_path. join ( ".git/objects" ) ,
173+ Vec :: new ( ) ,
174+ gix_odb:: store:: init:: Options {
175+ object_hash,
176+ ..Default :: default ( )
177+ } ,
178+ ) ?;
166179
167180 let mut reference = gix_ref:: file:: Store :: find ( & store, "HEAD" ) ?;
168181
@@ -172,7 +185,7 @@ impl Fixture {
172185 let head_id = reference. peel_to_id ( & store, & odb) ?;
173186
174187 let git_dir = worktree_path. join ( ".git" ) ;
175- let index = gix_index:: File :: at ( git_dir. join ( "index" ) , gix_hash :: Kind :: Sha1 , false , Default :: default ( ) ) ?;
188+ let index = gix_index:: File :: at ( git_dir. join ( "index" ) , object_hash , false , Default :: default ( ) ) ?;
176189 let stack = gix_worktree:: Stack :: from_state_and_ignore_case (
177190 worktree_path. clone ( ) ,
178191 false ,
0 commit comments