protocol-caps: use hash algorithm from passed-in repository

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 instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jun 14, 2024 at 08:50 UTC 58650befd9c99ab3ec4e946d5b3a50559e5ad309
1 file changed +2 -1
protocol-caps.c
+2 -1
@@ -7,6 +7,7 @@
7 #include "hex.h"
8 #include "object.h"
9 #include "object-store-ll.h"
10 +#include "repository.h"
11 #include "string-list.h"
12 #include "strbuf.h"
13
@@ -52,7 +53,7 @@ static void send_info(struct repository *r, struct packet_writer *writer,
53 struct object_id oid;
54 unsigned long object_size;
55
55 - if (get_oid_hex(oid_str, &oid) < 0) {
56 + if (get_oid_hex_algop(oid_str, &oid, r->hash_algo) < 0) {
57 packet_writer_error(
58 writer,
59 "object-info: protocol error, expected to get oid, not '%s'",