Skip to content

Commit 12e6b7b

Browse files
refactor
- add object-hash test - add env variable docs - remove seemingly unnecessary fixture hash setup. Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
1 parent 5932e88 commit 12e6b7b

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

gix-commitgraph/tests/commitgraph.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ pub fn graph_and_expected_named(
8181
let expected = inspect_refs(&repo_dir, refs);
8282
let cg =
8383
Graph::from_info_dir(&repo_dir.join(".git").join("objects").join("info")).expect("graph present and valid");
84+
let object_hash = cg.object_hash();
85+
if let Some(any_ref) = expected.values().next() {
86+
assert_eq!(
87+
object_hash,
88+
any_ref.id().kind(),
89+
"graph hash kind should match fixture object IDs"
90+
);
91+
}
8492
(cg, expected)
8593
}
8694

justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ unit-tests:
155155
cargo nextest run -p gix-archive --no-default-features --features tar_gz --no-fail-fast
156156
cargo nextest run -p gix-archive --no-default-features --features zip --no-fail-fast
157157
cargo nextest run -p gix-status-tests --features gix-features-parallel --no-fail-fast
158-
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel --no-fail-fast
159-
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-worktree-tests --features gix-features-parallel --no-fail-fast
158+
cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel --no-fail-fast
159+
cargo nextest run -p gix-worktree-tests --features gix-features-parallel --no-fail-fast
160160
cargo nextest run -p gix-error --no-fail-fast --test auto-chain-error --features auto-chain-error
161161
cargo nextest run -p gix-error --no-fail-fast
162162
cargo nextest run -p gix-hash --no-fail-fast
@@ -175,7 +175,7 @@ unit-tests:
175175
env GIX_TEST_FIXTURE_HASH=sha256 cargo nextest run -p gix-pack --all-features --no-fail-fast
176176
cargo nextest run -p gix-pack-tests --features all-features --no-fail-fast
177177
cargo nextest run -p gix-pack-tests --features gix-features-parallel --no-fail-fast
178-
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-index-tests --features gix-features-parallel --no-fail-fast
178+
cargo nextest run -p gix-index-tests --features gix-features-parallel --no-fail-fast
179179
cargo nextest run -p gix-packetline --features blocking-io,maybe-async/is_sync --test blocking-packetline --no-fail-fast
180180
cargo nextest run -p gix-packetline --features async-io --test async-packetline --no-fail-fast
181181
cargo nextest run -p gix-transport --features http-client-curl,maybe-async/is_sync --no-fail-fast

tests/tools/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
//! Utilities for testing `gitoxide` crates, many of which might be useful for testing programs that use `git` in general.
22
//!
3+
//! ## Environment Variables
4+
//!
5+
//! ### `GIX_TEST_FIXTURE_HASH`
6+
//!
7+
//! Set this variable to control which hash function is used when creating or loading test fixtures.
8+
//! Valid values are the names of hash functions supported by `gix_hash::Kind` (e.g., `sha1`, `sha256`).
9+
//! If not set, the default hash function via `gix_hash::Kind::default()` is used.
10+
//!
11+
312
//! ## Feature Flags
413
#![cfg_attr(
514
all(doc, feature = "document-features"),

0 commit comments

Comments
 (0)