Skip to content

Run gix-refspec tests with both sha1 and sha256#2448

Open
cruessler wants to merge 4 commits intoGitoxideLabs:mainfrom
cruessler:add-sha-256-to-gix-refspec
Open

Run gix-refspec tests with both sha1 and sha256#2448
cruessler wants to merge 4 commits intoGitoxideLabs:mainfrom
cruessler:add-sha-256-to-gix-refspec

Conversation

@cruessler
Copy link
Contributor

@cruessler cruessler commented Feb 28, 2026

This PR adds sha256 support to gix-refspec tests. It adds the sha256 feature flag to dev-dependencies and runs the test suite for gix-refspec for both sha1 and sha256. It adds separate branches for SHA-256 in a few places where SHA-1 hashes were hardcoded.

Open questions

  • gix-refspec/tests/fixtures/generated-archives/.gitignore includes /match_baseline.tar. Does it also need to include /match_baseline_sha256.tar? (I haven’t committed the latter yet.)
  • gix_refspec::parse::function::looks_like_object_hash uses gix_hash::Kind::shortest. Does it need to be changed? (I suspect it doesn’t.)

This PR is related to #281.

Copy link
Contributor

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

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: 3dcb7ee9b7

ℹ️ 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 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 address that feedback".

baseline "78b1c1be9421b33a49a7a8176d93eeeafa112da1:1111111111111111111111111111111111111111"
baseline "9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:tags/special"
baseline "9d2fab1a0ba3585d0bc50922bfdd04ebb59361df:refs/tags/special"
case $GIX_TEST_FIXTURE_HASH in
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 Badge Default fixture hash to sha1 when env var is unset

This script now unconditionally expands GIX_TEST_FIXTURE_HASH under set -u, so running the refspec tests without explicitly exporting that variable (for example via cargo nextest run -p gix-refspec) aborts fixture generation before any baseline is produced. Previously the tests worked with the default hash behavior, so this change introduces a regression unless every invocation path sets the env var; please make the script treat an unset value as sha1.

Useful? React with 👍 / 👎.

@cruessler cruessler marked this pull request as draft February 28, 2026 21:40
@cruessler cruessler marked this pull request as ready for review March 1, 2026 08:31
Copy link
Contributor

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

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: d58a35e673

ℹ️ 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 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 address that feedback".

cargo nextest run -p gix-protocol --features async-client --no-fail-fast
cargo nextest run -p gix-blame --no-fail-fast
env GIX_TEST_FIXTURE_HASH=sha1 cargo nextest run -p gix-refspec --no-fail-fast
env GIX_TEST_FIXTURE_HASH=sha256 cargo nextest run -p gix-refspec --no-fail-fast
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Ignore sha256 match baseline archive output

Running this newly added sha256 test command causes gix-testtools to look for gix-refspec/tests/fixtures/generated-archives/match_baseline_sha256.tar; when it is missing, the fixture runner creates it, and generated-archives/.gitignore currently excludes only /match_baseline.tar. That means unit-tests now leaves a new untracked binary file behind on normal local runs, which is a regression for workflows that expect a clean worktree after tests.

Useful? React with 👍 / 👎.

@cruessler cruessler changed the title Use GIX_TEST_FIXTURE_HASH for gix-refspec Run gix-refspec tests with both sha1 and sha256 Mar 3, 2026
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