]> git.ipfire.org Git - thirdparty/git.git/commit
rust: add additional helpers for ObjectID
authorbrian m. carlson <sandals@crustytoothpaste.net>
Mon, 17 Nov 2025 22:16:13 +0000 (22:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Nov 2025 22:24:15 +0000 (14:24 -0800)
commita8dfbc133a37df79fe49f71c43b8c07d666f1079
treeaa22278130724a9930b5849d92881c52000ec7f7
parenteae08d8bf7ee7b045371b5a64dc581e902703e58
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