Thread (16 messages) 16 messages, 2 authors, 2021-05-07
STALE1866d
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 13/13] hex: print objects using the hash algorithm member

From: brian m. carlson <hidden>
Date: 2021-04-26 01:03:41
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 hex.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hex.c b/hex.c
index 74d256f239..4f64d34696 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]);
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help