diff options
authorbrian m. carlson <>2019-09-29 23:01:19 +0000
committerbrian m. carlson <>2021-04-10 14:50:22 +0000
commit9883fec58b2096ceacb6d01c9b58ba6b57364605 (patch)
parent6c1e337b7f03cf9d8e793985b1d1a15179ade1b2 (diff)
hex: print objects using the hash algorithm membertransition-interop-part-1
Now that all code paths correctly set the hash algorithm member of struct object_id, write an object's hex representation using the hash algorithm member embedded in it. Signed-off-by: brian m. carlson <>
1 files changed, 2 insertions, 2 deletions
diff --git a/hex.c b/hex.c
index 43597b2dbb..4537e79d3c 100644
--- a/hex.c
+++ b/hex.c
@@ -143,7 +143,7 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash,
char *oid_to_hex_r(char *buffer, const struct object_id *oid)
- return hash_to_hex_algop_r(buffer, oid->hash, the_hash_algo);
+ return hash_to_hex_algop_r(buffer, oid->hash, &hash_algos[oid->algo]);
char *hash_to_hex_algop(const unsigned char *hash, const struct git_hash_algo *algop)
@@ -161,5 +161,5 @@ char *hash_to_hex(const unsigned char *hash)
char *oid_to_hex(const struct object_id *oid)
- return hash_to_hex_algop(oid->hash, the_hash_algo);
+ return hash_to_hex_algop(oid->hash, &hash_algos[oid->algo]);