Skip to content

Commit cd028f4

Browse files
cruesslerByron
authored andcommitted
Use GIX_TEST_FIXTURE_HASH for gix-blame
1 parent 048e8df commit cd028f4

6 files changed

Lines changed: 13 additions & 5 deletions

File tree

gix-blame/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ smallvec = "1.15.1"
3939
thiserror = "2.0.18"
4040

4141
[dev-dependencies]
42+
gix-hash = { version = "^0.23.0", path = "../gix-hash", features = ["sha1", "sha256"] }
4243
gix-ref = { path = "../gix-ref" }
4344
gix-filter = { path = "../gix-filter" }
4445
gix-fs = { path = "../gix-fs" }

gix-blame/tests/blame.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mod baseline {
7373

7474
fn next(&mut self) -> Option<Self::Item> {
7575
let mut ranges = None;
76-
let mut commit_id = gix_hash::Kind::Sha1.null();
76+
let mut commit_id = gix_testtools::hash_kind_from_env().unwrap_or_default().null();
7777
let mut skip_lines: u32 = 0;
7878
let mut source_file_name: Option<gix_object::bstr::BString> = None;
7979

@@ -162,7 +162,12 @@ impl Fixture {
162162
..Default::default()
163163
},
164164
);
165-
let odb = gix_odb::at(worktree_path.join(".git/objects"))?;
165+
let object_hash = gix_testtools::hash_kind_from_env().unwrap_or_default();
166+
let options = gix_odb::store::init::Options {
167+
object_hash,
168+
..Default::default()
169+
};
170+
let odb = gix_odb::at_opts(worktree_path.join(".git/objects"), Vec::new(), options)?;
166171

167172
let mut reference = gix_ref::file::Store::find(&store, "HEAD")?;
168173

@@ -172,7 +177,7 @@ impl Fixture {
172177
let head_id = reference.peel_to_id(&store, &odb)?;
173178

174179
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())?;
180+
let index = gix_index::File::at(git_dir.join("index"), object_hash, false, Default::default())?;
176181
let stack = gix_worktree::Stack::from_state_and_ignore_case(
177182
worktree_path.clone(),
178183
false,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
make_blame_repo.tar
1+
make_blame_repo.tar
2+
make_blame_repo_sha256.tar
Binary file not shown.
Binary file not shown.

justfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ unit-tests:
238238
cargo nextest run -p gix-transport --features async-client --no-fail-fast
239239
cargo nextest run -p gix-protocol --features blocking-client --no-fail-fast
240240
cargo nextest run -p gix-protocol --features async-client --no-fail-fast
241-
cargo nextest run -p gix-blame --no-fail-fast
241+
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-blame --no-fail-fast
242+
env GIX_TEST_FIXTURE_HASH=sha256 cargo nextest run -p gix-blame --no-fail-fast
242243
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-refspec --no-fail-fast
243244
env GIX_TEST_FIXTURE_HASH=sha256 cargo nextest run -p gix-refspec --no-fail-fast
244245
cargo nextest run -p gix --no-default-features --no-fail-fast

0 commit comments

Comments
 (0)