diff mbox series

[v3,14/20] protocol-caps: use hash algorithm from passed-in repository

Message ID 0b42208e2f675d6f7f24b842f42b16bf38e1138e.1718347699.git.ps@pks.im (mailing list archive)
State Accepted
Commit 58650befd9c99ab3ec4e946d5b3a50559e5ad309
Headers show
Series Introduce `USE_THE_REPOSITORY_VARIABLE` macro | expand

Commit Message

Patrick Steinhardt June 14, 2024, 6:50 a.m. UTC
In `send_info()`, we pass in a repository but then use `get_oid_hex()`
to parse passed-in object IDs, which implicitly uses `the_repository`.
Fix this by using the hash algorithm from the passed-in repository

Signed-off-by: Patrick Steinhardt <ps@pks.im>
 protocol-caps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/protocol-caps.c b/protocol-caps.c
index fe8d1d5c63..855f279c2f 100644
--- a/protocol-caps.c
+++ b/protocol-caps.c
@@ -7,6 +7,7 @@ 
 #include "hex.h"
 #include "object.h"
 #include "object-store-ll.h"
+#include "repository.h"
 #include "string-list.h"
 #include "strbuf.h"
@@ -52,7 +53,7 @@  static void send_info(struct repository *r, struct packet_writer *writer,
 		struct object_id oid;
 		unsigned long object_size;
-		if (get_oid_hex(oid_str, &oid) < 0) {
+		if (get_oid_hex_algop(oid_str, &oid, r->hash_algo) < 0) {
 				"object-info: protocol error, expected to get oid, not '%s'",