hash: require hash algorithm in empty_tree_oid_hex()

The `empty_tree_oid_hex()` function use `the_repository` to derive the
hash function that shall be used. Require callers to pass in the hash
algorithm to get rid of this implicit dependency.

While at it, remove the unused `empty_blob_oid_hex()` function.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-06-14 08:50:18 +02:00
committed by Junio C Hamano
parent 9c34eb93fb
commit 7abbca0e74
9 changed files with 14 additions and 20 deletions

View File

@ -227,16 +227,10 @@ const struct object_id *null_oid(void)
return the_hash_algo->null_oid;
}
const char *empty_tree_oid_hex(void)
const char *empty_tree_oid_hex(const struct git_hash_algo *algop)
{
static char buf[GIT_MAX_HEXSZ + 1];
return oid_to_hex_r(buf, the_hash_algo->empty_tree);
}
const char *empty_blob_oid_hex(void)
{
static char buf[GIT_MAX_HEXSZ + 1];
return oid_to_hex_r(buf, the_hash_algo->empty_blob);
return oid_to_hex_r(buf, algop->empty_tree);
}
int hash_algo_by_name(const char *name)