diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-06-14 08:50:18 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-14 10:26:33 -0700 |
| commit | 7abbca0e7470d1f7b6973933358c17022c6ee8a1 (patch) | |
| tree | ca407e02f2c2e189f1e250ae7b8e964dbb409210 /object-file.c | |
| parent | hash: require hash algorithm in `is_empty_{blob,tree}_oid()` (diff) | |
| download | git-7abbca0e7470d1f7b6973933358c17022c6ee8a1.tar.gz git-7abbca0e7470d1f7b6973933358c17022c6ee8a1.zip | |
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>
Diffstat (limited to 'object-file.c')
| -rw-r--r-- | object-file.c | 10 |
1 files changed, 2 insertions, 8 deletions
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) |
