From 7abbca0e7470d1f7b6973933358c17022c6ee8a1 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 14 Jun 2024 08:50:18 +0200 Subject: 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 Signed-off-by: Junio C Hamano --- object-file.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'object-file.c') diff --git a/object-file.c b/object-file.c index bb97f8a809..72318c8dd4 100644 --- a/object-file.c +++ b/object-file.c @@ -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) -- cgit v1.3-5-g9baa