]> git.ipfire.org Git - thirdparty/git.git/commit
rust: add additional helpers for ObjectID
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 7 Feb 2026 20:04:37 +0000 (20:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 8 Feb 2026 01:41:02 +0000 (17:41 -0800)
commit86215ab0cc632026a95aa955ebe94c8f33ff2be6
tree2394e3a3e9a19459c3f43dafa87920a90f5c891b
parent9005b5bb72df521670db03eefeafe53c0a81f9a5
rust: add additional helpers for ObjectID

Right now, users can internally access the contents of the ObjectID
struct, which can lead to data that is not valid, such as invalid
algorithms or non-zero-padded hash values.  These can cause problems
down the line as we use them more.

Add a constructor for ObjectID that allows us to set these values and
also provide an accessor for the algorithm so that we can access it.  In
addition, provide useful Display and Debug implementations that can
format our data in a useful way.

Now that we have the ability to work with these various components in a
nice way, add some tests as well to make sure that ObjectID and
HashAlgorithm work together as expected.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
src/hash.rs