Skip to content

Use GIX_TEST_FIXTURE_HASH for gix-archive tests - #2893

Open
Christoph Rüßler (cruessler) wants to merge 1 commit into
GitoxideLabs:mainfrom
cruessler:run-gix-archive-tests-with-sha-256
Open

Use GIX_TEST_FIXTURE_HASH for gix-archive tests#2893
Christoph Rüßler (cruessler) wants to merge 1 commit into
GitoxideLabs:mainfrom
cruessler:run-gix-archive-tests-with-sha-256

Conversation

@cruessler

Copy link
Copy Markdown
Contributor

This PR makes gix-archive tests run with GIX_TEST_FIXTURE_HASH=sha256.

The changes are pretty straightforward, but there’s one thing I’m not sure about: justfile has 5 new cargo nextest entries in this initial version. If you feel this is unwarranted, feel free to remove those that are not needed.

In this PR, I tried to follow the patterns used in 3bca1a1.

Some of the code changes, in particular the exact SHA-1 to SHA-256 mappings, were drafted by GPT-5.5.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33d1003de8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread justfile
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-archive --no-default-features --features sha1,tar --no-fail-fast
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-archive --no-default-features --features sha1,tar_gz --no-fail-fast
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-archive --no-default-features --features sha1,zip --no-fail-fast
env GIX_TEST_FIXTURE_HASH=sha256 cargo nextest run -p gix-archive --features sha256 --no-fail-fast

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid extracting the Unix sha256 fixture on Windows

On Windows/local runs where GIX_TEST_IGNORE_ARCHIVES is not set, this newly added sha256 test mode will cause scripted_fixture_read_only("basic.sh") to prefer the checked-in basic_sha256.tar instead of rerunning the fixture script. The existing fixture ignore file explicitly says basic.sh uses symlinks and executable bits that cannot be round-tripped from archives on every supported platform (gix-archive/tests/fixtures/generated-archives/.gitignore:1-5), and the helper extracts existing archives by default (tests/tools/src/lib.rs:705-707), so the sha256 archive path reintroduces the non-portable fixture behavior the sha1 path avoids.

Useful? React with 👍 / 👎.

#[cfg(target_pointer_width = "32")]
let expected_buffer_length = match gix_testtools::object_hash() {
gix_hash::Kind::Sha1 => 479,
gix_hash::Kind::Sha256 => todo!("let the test fail on CI and add the value here"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fill in the 32-bit SHA-256 stream length

On 32-bit targets with GIX_TEST_FIXTURE_HASH=sha256 (the justfile now invokes that mode), this todo! panics before the assertion can run, so the gix-archive sha256 tests cannot pass on i686/armv7. The expected length is deterministic here — the sha1 value plus nine entries times the 12 extra SHA-256 id bytes — so this should use the actual 32-bit value instead of a runtime placeholder.

Useful? React with 👍 / 👎.

@cruessler
Christoph Rüßler (cruessler) force-pushed the run-gix-archive-tests-with-sha-256 branch from 33d1003 to 4a0ca97 Compare August 7, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant