Add ObjectId::Sha256 and Kind::Sha256
#2292
Draft
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.

This is a draft that adds
ObjectId::Sha256andKind::Sha256togix-hash. I’m opening this to get early feedback, in particular from a CI run.Some remarks:
empty_blob_sha256andempty_tree_sha256intooidas the comment saysoidis related toSha1, but I’m unsure how to best resolve this tension.SHA256,SHA-256,Sha256.ObjectId::null_sha1hardcodes 20. Should this beSIZE_OF_SHA1_DIGEST?oid::null_sha1usesSIZE_OF_SHA1_DIGEST.Kind::len_in_hexandKind::len_in_bytesalso hardcode values.ObjectIdwould probably benefit from being rephrased. See e. g.ObjectId::new_sha1orObjectId::from_20_bytes.Sources for the hardcoded values related to SHA-256:
https://github.com/git/git/blob/e85ae279b0d58edc2f4c3fd5ac391b51e1223985/hash.h
https://github.com/git/git/blob/e85ae279b0d58edc2f4c3fd5ac391b51e1223985/hash.c