Even though the foundation is set, it needs another push to actually make it work with different kinds of hashes.
Tasks
Crates Completed
Tasks
(generated by Codex, needs individual review and adjustment)
Based on issue #281 and current repo state, here is an effort-ordered crate list.
Implementation ideas
- make sure once Sha256 is added as ObjectId variant, that it's behind a feature toggle to allow builds that opt-out of SHA256 support to not unnecessarily use more memory than needed. Maybe there are alternatives to this, too.
-
One way to do that with approximately zero overhead would be to such functions generic on the object ID, using a trait that has a method to get the type. Then object IDs with a known type return a constant from that method, and object IDs with a runtime dispatched type return the value of that enum.
- Josh Triplett (@joshtriplett) - taken verbatim as I'd barely be able to improve on it when paraphrasing. In short, have a trait for
oid or allow efficient conversions to oid (it's just a slice, so that should work for specifically sized types as well especially if these were provided by git-hash.
Notes
- find ways to use the existing highly-parallel pack traversal (along with integration of loose-objects) to build an inverse-ref table to quickly traverse objects bottom-up to change the hash used along with all references, while being fast. This ties into being able to build new packs quickly, ideally even with delta-compression (the latter then has to be re-created as most objects actually change) - re-using deltas for blobs is the only way.
- The existing traversal can mutate data in the tree, which is enough to decode the object and keep direct references for later.
Related
Even though the foundation is set, it needs another push to actually make it work with different kinds of hashes.
Tasks
git-hashand replace them with parametric usage ofgit_hash::Kind--object-hashinformation to thegixCLIsha1feature fromgix-hashcrate and deal with the falloutsha1by defaultcargo check -p gix-<name>to show it's failing with an error messagegixchose SHA1 as defaultgit-featuresfeature togglesunderstand and implement pack idx V3.- see if git actually implements this, and maybe decide thatgitoxidewon't handle the transition period, is either one has or another.uninmplemented!()invocation to configure the repo for expecting a different hashCrates Completed
gix-commitgraph- minor testing, run tests with multiple hash kindsTasks
(generated by Codex, needs individual review and adjustment)
Based on issue #281 and current repo state, here is an effort-ordered crate list.
gix-hash(small, foundational): remove defaultsha1, keep explicitsha1/sha256features, and keep no-default build/tests green; watch out for Cargo feature additivity and clear compile errors when no hash is selected.gix-refspec(small): add explicit SHA256 parse tests for object-hash-looking refspecs; watch out for logic that implicitly treats 40-hex as “an object hash”.gix-filter+gix-worktree-stream(small to medium): add explicit dual-hash tests for filter/stream paths; watch out for protocol/hash-kind encoding paths that currently default to SHA1 semantics.gix-blame+gix-diff(medium): remove hardcodedKind::Sha1.null()sentinels where possible and add SHA256 fixtures; watch out for sentinel IDs that must stay “impossible/non-matching” rather than repo-real IDs.gix-object(medium): parameterize non-blob/tree decode by hash length and add SHA256 object decode/encode tests; watch out for the tree parser hotspot that still splits at 20 bytes (TODO(SHA256)).gix-ref(medium): add explicit refs/reflog read-write tests for both hash lengths; watch out for many 40-char and SHA1-null expectations in tests.gix-index(medium-high): extend index/extension roundtrip tests for SHA256; watch out for offset/checksum math tied tolen_in_bytes()and trailing checksum region assumptions.gix-protocol+gix-transport(medium-high): addobject-format=sha256negotiation tests end-to-end; watch out for code paths that currently accept/fallback only to SHA1.gix-odb(high): add explicit loose/packed read-write and prefix lookup tests under SHA256; watch out for SHA1-shaped helpers (e.g., 20-byte helpers and 40-hex prefix assumptions).gix-pack(very high): full SHA256 coverage for pack data/index/multi-index read-write and verification; watch out for SHA1-only assertions and format/version assumptions in pack/index code.gix(very high): implement and test clone/fetch repo reconfiguration when remote hash kind differs; watch out for the current cloneunimplemented!()on object-hash mismatch.TODO(SHA256)or similar, and forgix_hash::Kind::Sha1::null()and similarImplementation ideas
oidor allow efficient conversions tooid(it's just a slice, so that should work for specifically sized types as well especially if these were provided bygit-hash.Notes
Related
gix-hash#2332sha256feature togix-object#2359