index-pack, unpack-objects: restore missing ->init_fn
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>
Jensen Huang committed
Mar 18, 2025 at 19:16 UTC
d39f04b638f7f862efebb5bf028bad50f6aa9e28
2 files changed
+2
builtin/index-pack.c
+1
@@ -1286,6 +1286,7 @@ static void parse_pack_objects(unsigned char *hash)
1286
1287
/* Check pack integrity */
1288
flush();
1289
+ the_hash_algo->init_fn(&tmp_ctx);
1290
git_hash_clone(&tmp_ctx, &input_ctx);
1291
git_hash_final(hash, &tmp_ctx);
1292
if (!hasheq(fill(the_hash_algo->rawsz), hash, the_repository->hash_algo))
builtin/unpack-objects.c
+1
@@ -668,6 +668,7 @@ int cmd_unpack_objects(int argc,
668
the_hash_algo->init_fn(&ctx);
669
unpack_all();
670
git_hash_update(&ctx, buffer, offset);
671
+ the_hash_algo->init_fn(&tmp_ctx);
672
git_hash_clone(&tmp_ctx, &ctx);
673
git_hash_final_oid(&oid, &tmp_ctx);
674
if (strict) {