]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/helper: use correct object hash in partial-clone helper
authorPatrick Steinhardt <ps@pks.im>
Fri, 14 Jun 2024 06:51:00 +0000 (08:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 14 Jun 2024 17:26:34 +0000 (10:26 -0700)
The `object_info()` function of the partial-clone helper is responsible
for checking the object ID of a repository other than `the_repository`.
We use `parse_oid_hex()` in this function though, which means that we
still depend on `the_repository->hash_algo`.

Fix this by using the object hash of the function-local repository.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-partial-clone.c

index 910a12861442264ca951a1a2ef27e6fb20eb7985..0ead529167a1eb18bbb176281bfb7a5d0e1c23f2 100644 (file)
@@ -21,7 +21,7 @@ static void object_info(const char *gitdir, const char *oid_hex)
 
        if (repo_init(&r, gitdir, NULL))
                die("could not init repo");
-       if (parse_oid_hex(oid_hex, &oid, &p))
+       if (parse_oid_hex_algop(oid_hex, &oid, &p, r.hash_algo))
                die("could not parse oid");
        if (oid_object_info_extended(&r, &oid, &oi, 0))
                die("could not obtain object info");