Merge branch 'jh/hash-init-fixes'

An earlier code refactoring of the hash machinery missed a few
required calls to init_fn.

* jh/hash-init-fixes:
  index-pack, unpack-objects: restore missing ->init_fn
This commit is contained in:
Junio C Hamano
2025-04-07 14:23:18 -07:00
2 changed files with 2 additions and 0 deletions

View File

@@ -1286,6 +1286,7 @@ static void parse_pack_objects(unsigned char *hash)
/* Check pack integrity */ /* Check pack integrity */
flush(); flush();
the_hash_algo->init_fn(&tmp_ctx);
git_hash_clone(&tmp_ctx, &input_ctx); git_hash_clone(&tmp_ctx, &input_ctx);
git_hash_final(hash, &tmp_ctx); git_hash_final(hash, &tmp_ctx);
if (!hasheq(fill(the_hash_algo->rawsz), hash, the_repository->hash_algo)) if (!hasheq(fill(the_hash_algo->rawsz), hash, the_repository->hash_algo))

View File

@@ -668,6 +668,7 @@ int cmd_unpack_objects(int argc,
the_hash_algo->init_fn(&ctx); the_hash_algo->init_fn(&ctx);
unpack_all(); unpack_all();
git_hash_update(&ctx, buffer, offset); git_hash_update(&ctx, buffer, offset);
the_hash_algo->init_fn(&tmp_ctx);
git_hash_clone(&tmp_ctx, &ctx); git_hash_clone(&tmp_ctx, &ctx);
git_hash_final_oid(&oid, &tmp_ctx); git_hash_final_oid(&oid, &tmp_ctx);
if (strict) { if (strict) {