Skip to content

basic SHA-256 support#2581

Merged
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
improvements
May 7, 2026
Merged

basic SHA-256 support#2581
Sebastian Thiel (Byron) merged 2 commits into
mainfrom
improvements

Conversation

@Byron

@Byron Sebastian Thiel (Byron) commented May 7, 2026

Copy link
Copy Markdown
Member

Minimal changes to push for basic SHA-256 readiness.

Without protocol support.

Tasks

  • gix-pack with SHA-256 support
  • basic gix sha-256 support

@Byron Sebastian Thiel (Byron) changed the title various improvements basic SHA-256 support May 7, 2026
@Byron Sebastian Thiel (Byron) force-pushed the improvements branch 2 times, most recently from 2e79c18 to b8d2f9a Compare May 7, 2026 08:30
@Byron Sebastian Thiel (Byron) marked this pull request as ready for review May 7, 2026 12:13
Copilot AI review requested due to automatic review settings May 7, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR pushes the codebase toward “basic SHA-256 readiness” by (1) enabling SHA-256 in more dev/test configurations, (2) adjusting gix tests/fixtures to run under SHA-256 without hard-coding SHA-1 object IDs, and (3) plumbing object_hash through parts of gix-pack writing/verification so pack/index handling can operate with SHA-256 object formats.

Changes:

  • Run gix test suite under GIX_TEST_FIXTURE_HASH=sha256, and update many gix tests to compute/normalize object IDs instead of snapshotting SHA-1 literals.
  • Teach gix config parsing to accept extensions.objectFormat=sha256 when the feature is enabled; ensure fixtures that rely on SHA-1 semantics force GIT_DEFAULT_HASH=sha1.
  • Parameterize gix-pack index encoding/writing and pack output tests over object_hash (and enable sha1+sha256 features in the pack test crate).

Reviewed changes

Copilot reviewed 31 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
justfile Adds a gix nextest run under GIX_TEST_FIXTURE_HASH=sha256.
gix/tests/gix/util.rs Adds SHA1→SHA256 mapping and makes hex_to_id() hash-kind aware.
gix/tests/gix/status.rs Normalizes status snapshots to avoid hash-kind-specific IDs; removes SHA-1 literals.
gix/tests/gix/revision/spec/from_bytes/mod.rs Stabilizes snapshots across varying fixture hash/seed; avoids SHA-1-only constants.
gix/tests/gix/repository/worktree.rs Adjusts expected buffer length based on object hash hex length.
gix/tests/gix/repository/shallow.rs Updates shallow traversal expectations to support SHA-256 fixtures.
gix/tests/gix/repository/reference.rs Uses repo’s object hash when creating empty-tree IDs.
gix/tests/gix/repository/object.rs Normalizes tree display output; computes expected blob IDs via hashing; relaxes SHA-1 stability assertions.
gix/tests/gix/repository/filter.rs Computes expected object IDs from content and submodule HEAD instead of hard-coded SHA-1.
gix/tests/gix/repository/config/config_snapshot/mod.rs Makes abbrev expectations derived from the actual head id string.
gix/tests/gix/reference/mod.rs Builds expected error messages from computed IDs (short prefixes) rather than SHA-1 literals.
gix/tests/gix/object/tree/mod.rs Avoids assuming fixture hash kind; flips between Sha1/Sha256 for “bogus id” construction.
gix/tests/gix/object/tree/diff.rs Guards SHA-1-specific snapshots; skips certain rewrite tests under SHA-256.
gix/tests/gix/object/commit.rs Reuses shared util::hex_to_id instead of local SHA-1-only helper.
gix/tests/gix/id.rs Reuses shared util::hex_to_id; makes debug output assertion hash-kind aware.
gix/tests/gix/config/tree.rs Makes extensions.objectFormat tests conditional on enabled hash features.
gix/tests/fixtures/make_rev_spec_parse_repos.sh Forces GIT_DEFAULT_HASH=sha1 for SHA-1 disambiguation fixture correctness.
gix/tests/fixtures/make_rev_parse_repo.sh Forces GIT_DEFAULT_HASH=sha1 for reflog fixture correctness.
gix/src/config/tree/sections/extensions.rs Accepts sha256 for extensions.objectFormat when the feature is enabled.
gix/Cargo.toml Enables sha256 feature for gix self dev-dependency used in tests.
gix-pack/tests/pack/multi_index/verify.rs Parameterizes multi-index fixture opening and expectations by object_hash.
gix-pack/tests/pack/multi_index/mod.rs Requires expected object_hash when opening the multi-index fixture.
gix-pack/tests/pack/multi_index/access.rs Makes multi-index access tests work with either hash kind; finds ambiguous prefixes dynamically.
gix-pack/tests/pack/mod.rs Adds object_hash() and hex_to_id_for_hash() helpers for dual-hash tests.
gix-pack/tests/pack/data/output/mod.rs Opens ODB with explicit object_hash in init options.
gix-pack/tests/pack/data/output/count_and_entries.rs Parameterizes expected counts/IDs/offsets and pack writing over object_hash.
gix-pack/tests/Cargo.toml Enables sha1+sha256 features for pack tests and dependencies.
gix-pack/src/index/write/mod.rs Threads object_hash into object-id computation and index encoding.
gix-pack/src/index/encode.rs Hashes index output using object_hash and adjusts trailer size accounting.
gix-pack/src/data/input/entries_to_bytes.rs Removes SHA-1-only gating; uses object_hash for trailer digest length.
gix-pack/src/bundle/write/mod.rs Uses the selected object_hash for thin-pack writing path as well.

Comment thread gix/tests/gix/util.rs
Comment thread gix/tests/gix/repository/shallow.rs
Comment thread gix-pack/src/data/input/entries_to_bytes.rs
Codex (codex) and others added 2 commits May 7, 2026 21:09
This means that if compiled in, SHA-256 packs can now be read and used.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
@Byron Sebastian Thiel (Byron) merged commit 8af2691 into main May 7, 2026
32 checks passed
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.

3 participants