basic SHA-256 support#2581
Merged
Merged
Conversation
2e79c18 to
b8d2f9a
Compare
There was a problem hiding this comment.
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
gixtest suite underGIX_TEST_FIXTURE_HASH=sha256, and update manygixtests to compute/normalize object IDs instead of snapshotting SHA-1 literals. - Teach
gixconfig parsing to acceptextensions.objectFormat=sha256when the feature is enabled; ensure fixtures that rely on SHA-1 semantics forceGIT_DEFAULT_HASH=sha1. - Parameterize
gix-packindex encoding/writing and pack output tests overobject_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. |
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>
b8d2f9a to
011316e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Minimal changes to push for basic SHA-256 readiness.
Without protocol support.
Tasks
gix-packwith SHA-256 supportgixsha-256 support