]> git.ipfire.org Git - thirdparty/git.git/commitdiff
protocol-caps: use hash algorithm from passed-in repository
authorPatrick Steinhardt <ps@pks.im>
Fri, 14 Jun 2024 06:50:47 +0000 (08:50 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jun 2024 17:26:34 +0000 (10:26 -0700)
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>
protocol-caps.c

index fe8d1d5c6384ba3e1424fa7a372239952b6c539d..855f279c2f7a4f28b9435021966ef14cdddbf014 100644 (file)
@@ -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) {
                        packet_writer_error(
                                writer,
                                "object-info: protocol error, expected to get oid, not '%s'",