1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-03-28 14:30:23 +01:00

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>
This commit is contained in:
brian m. carlson 2021-04-26 01:03:01 +00:00 committed by Junio C Hamano
parent b8505ecbf2
commit 3dd71461e2

4
hex.c
View File

@ -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]);
}