hex: print objects using the hash algorithm member

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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed Apr 26, 2021 at 01:03 UTC 3dd71461e25b4cc7ea2a2d8deef1c0486bb32580
1 file changed +2 -2
hex.c
+2 -2
@@ -143,7 +143,7 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash,
143
144 char *oid_to_hex_r(char *buffer, const struct object_id *oid)
145 {
146 - return hash_to_hex_algop_r(buffer, oid->hash, the_hash_algo);
146 + return hash_to_hex_algop_r(buffer, oid->hash, &hash_algos[oid->algo]);
147 }
148
149 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)
161
162 char *oid_to_hex(const struct object_id *oid)
163 {
164 - return hash_to_hex_algop(oid->hash, the_hash_algo);
164 + return hash_to_hex_algop(oid->hash, &hash_algos[oid->algo]);
165 }