etc/plan/sha256-support.md
Source issue: GitoxideLabs/gitoxide#281
Imported on: 2026-04-22
Last reconciled: 2026-05-08
Working assumption: checkboxes in this file reflect current checkout, not only historical issue state.
Make object-hash kind first-class across config, protocol, storage, tests, and clone flow so SHA1 and SHA256 are both deliberate runtime choices instead of SHA1 being hidden fallback everywhere.
gix-hash and lean on gix_hash::Kind-parametric usage.
Evidence: gix-hash still contains new_sha1, new_sha256, from_20_bytes, from_32_bytes, null_sha1, null_sha256.Kind::Sha1.null()/ObjectId::null(...Sha1) call sites still remain, plus a few explicit 20-byte comments and helpers.src/plumbing/options/mod.rs and src/plumbing/options/free.rs expose clap object_hash fields, which produce --object-hash.sha256 feature support through crates that participate in object traversal, object parsing, and object-id storage.
Evidence: 31 workspace packages now define a sha256 feature, including gix-object, gix-index, gix-protocol, gix-ref, gix-refspec, gix-traverse, and top-level gix.cargo check -p gix --no-default-features --features sha256 fails because gix/src/config/cache/incubate.rs and gix/src/config/tree/sections/core.rs still name gix_hash::Kind::Sha1 unconditionally.sha1 feature from gix-hash and deal with fallout.
Evidence: gix-hash has default = [], docs.rs explicitly enables sha1, root gitoxide chooses SHA1 via features, and justfile contains compile-guard checks for missing hash selection.gix-features feature toggles.
Evidence: gix-features/Cargo.toml has no SHA1/SHA256 feature toggles anymore.gix-object tree decoding hotspot uses hash_kind.len_in_bytes().Sha256 enum variant and hasher support.
Evidence: gix_hash::Kind::Sha256, ObjectId::Sha256, and Hasher::Sha256 exist.justfile runs SHA256 fixture suites for gix-object, gix-ref-tests, gix-traverse-tests, and top-level gix.gix/src/clone/fetch/mod.rs still has unimplemented!("configure repository to expect a different object hash as advertised by the server").Workspace signals on 2026-05-08:
gix-hash default hash feature: removedjustfile: 8sha256 = ... feature declarations: 31gix-traverse hash feature declarations: sha1 and sha256Kind::Sha1.null()/ObjectId::null(...Sha1) occurrences outside this plan and changelogs: 79object-format=sha1 fixture occurrences outside this plan: 10object-format=sha256 fixture occurrences outside this plan: 0unimplemented!() for hash mismatch: 1cargo check -p gix --no-default-features --features sha256: fails on unconditional Kind::Sha1 references in gixDual-hash test hooks already exist in justfile for at least:
gixgix-filtergix-diffgix-status-testsgix-commitgraphgix-objectgix-ref-testsgix-packgix-diff-testsgix-traverse-testsgix-blamegix-refspecgix-worktree-streamgix-hashgix-commitgraph
Evidence: issue marked it complete, dev-dependencies enable gix-hash with sha1 and sha256, and justfile runs it with GIX_TEST_FIXTURE_HASH=sha1 and sha256.gix-traverse feature declaration
Evidence: gix-traverse/Cargo.toml now defines both sha1 and sha256.extensions.objectFormat=sha256 parsing
Evidence: gix/src/config/tree/sections/extensions.rs accepts sha256 behind the feature, and gix/tests/gix/config/tree.rs covers lowercase and uppercase SHA256.gix/src/config/cache/incubate.rs
Repository object hash still falls back to SHA1 when config does not say otherwise, and the unconditional Kind::Sha1 references break SHA256-only gix builds.gix/src/config/tree/sections/core.rs
core.abbrev validation still passes Kind::Sha1 unconditionally for a context that may compile without SHA1.gix-protocol/src/fetch/refmap/init.rs
object-format capability parsing still rejects anything except sha1.gix/src/clone/fetch/mod.rs
Clone still aborts on remote hash mismatch instead of configuring repo state.gix/Cargo.toml
Top-level sha256 currently forwards to gix-hash, gix-pack, and optional gix-worktree-stream, but not to all direct dependencies that define their own hash features; confirm whether this is intentional feature unification or an under-forwarding gap.gix-worktree-stream/Cargo.toml
Its sha256 feature forwards only gix-hash/sha256. This may be acceptable because dependencies currently avoid SHA-specific cfgs, but it should be verified against feature-isolated builds.gix-hash
Remove remaining SHA1/SHA256-shaped helper APIs where Kind-based forms can replace them.sha256 features where crates already have hash-sensitive APIs or compile guards, including gix-traverse.gitoxide CLI surface
Keep the clap-derived --object-hash selection on plumbing commands.Kind::Sha1 fallbacks in gix config/cache paths with feature-aware defaults or required configuration.gix-refspec
Keep object-hash-looking refspec parsing honest under SHA256-heavy inputs.gix
Teach extensions.objectFormat config parsing to accept sha256.gix
Decide the correct default/fallback behavior when no extensions.objectFormat exists and SHA1 is not compiled in.gix-object
Keep object parsers hash-length aware and extend tests around non-SHA1 trees and related decode paths.gix-ref
Expand refs and reflog read/write coverage to both hash lengths.gix-index
Extend checksum and extension tests to SHA256-sized object ids.gix-traverse
Add sha256 feature support and a SHA256 fixture run in justfile.gix-transport
Add negotiation fixtures that advertise object-format=sha256.gix-protocol
Accept and preserve SHA256 object-format negotiation end to end.gix-odb
Strengthen loose/packed lookup and prefix behavior under SHA256.gix-pack
Finish pack data, index, multi-index, and verification assumptions that still lean on SHA1-shaped fixtures or sentinels.gix
Replace clone hash-mismatch unimplemented!() with real repo initialization/configuration.gix-diff
Remove SHA1-only sentinel assumptions where caller hash kind should drive impossible ids.gix-blame
Same sentinel cleanup where SHA1 null ids are only placeholders.gix-traverse
Replace remaining SHA1 defaults in traversal state with caller/repository hash kind where traversal starts from generic object ids.Kind::Sha1.null() occurrences one by one and separate acceptable sentinels from real SHA1 assumptions.gix compilation by removing unconditional Kind::Sha1 references from config/cache code paths.object-format=sha256.unimplemented!() for remote hash mismatch.gix build compiles when requested by features.object-format=sha256.