]> git.ipfire.org Git - thirdparty/git.git/commitdiff
index-pack, unpack-objects: restore missing ->init_fn
authorJensen Huang <hmz007@gmail.com>
Tue, 18 Mar 2025 11:16:10 +0000 (19:16 +0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Mar 2025 19:27:33 +0000 (12:27 -0700)
Commit 0578f1e66a ("global: adapt callers to use generic hash context helpers")
accidentally removed `->init_fn`, which is required for OpenSSL 3+ SHA1.

This fixes the following error on fetch:
  fatal: fetch-pack: invalid index-pack output

Signed-off-by: Jensen Huang <hmz007@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/index-pack.c
builtin/unpack-objects.c

index 5ee13661a1e03b678d9d2fe2cac9510d4c1e4fd1..c7ac0795730f889f4f7418f682e69c549d374eac 100644 (file)
@@ -1286,6 +1286,7 @@ static void parse_pack_objects(unsigned char *hash)
 
        /* Check pack integrity */
        flush();
+       the_hash_algo->init_fn(&tmp_ctx);
        git_hash_clone(&tmp_ctx, &input_ctx);
        git_hash_final(hash, &tmp_ctx);
        if (!hasheq(fill(the_hash_algo->rawsz), hash, the_repository->hash_algo))
index 8383bcf404957d7e7641ffacc09b9679e6be2dbb..c5a6dca85651a93eb2ff93ea6331f00406663609 100644 (file)
@@ -668,6 +668,7 @@ int cmd_unpack_objects(int argc,
        the_hash_algo->init_fn(&ctx);
        unpack_all();
        git_hash_update(&ctx, buffer, offset);
+       the_hash_algo->init_fn(&tmp_ctx);
        git_hash_clone(&tmp_ctx, &ctx);
        git_hash_final_oid(&oid, &tmp_ctx);
        if (strict) {