Skip to content

Commit 3dd7146

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b8505ec commit 3dd7146

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ char *hash_to_hex_algop_r(char *buffer, const unsigned char *hash,
143143

144144
char *oid_to_hex_r(char *buffer, const struct object_id *oid)
145145
{
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]);
147147
}
148148

149149
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)
161161

162162
char *oid_to_hex(const struct object_id *oid)
163163
{
164-
return hash_to_hex_algop(oid->hash, the_hash_algo);
164+
return hash_to_hex_algop(oid->hash, &hash_algos[oid->algo]);
165165
}

0 commit comments

Comments
 (0)