]> Kevux Git Server - rit/commit
rust: add functionality to hash an object
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sat, 7 Feb 2026 20:04:43 +0000 (20:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 8 Feb 2026 01:41:03 +0000 (17:41 -0800)
commit0c04f2621ed7cbdff8b11f680fb66e1a9807f5b1
treec90f7a932990f862c47f05ba72ddc07de1397605
parent3bb0b0afaba588c04982103534afa2aae922f5bf
rust: add functionality to hash an object

In a future commit, we'll want to hash some data when dealing with an
object map.  Let's make this easy by creating a structure to hash
objects and calling into the C functions as necessary to perform the
hashing.  For now, we only implement safe hashing, but in the future we
could add unsafe hashing if we want.  Implement Clone and Drop to
appropriately manage our memory.  Additionally implement Write to make
it easy to use with other formats that implement this trait.

While we're at it, add some tests for the various hashing cases.

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