From: Junio C Hamano Date: Mon, 10 Feb 2025 18:18:30 +0000 (-0800) Subject: Merge branch 'ps/hash-cleanup' X-Git-Tag: v2.49.0-rc0~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=246569bf83f2a586268d26559c7d6ea54c9316b6;p=thirdparty%2Fgit.git Merge branch 'ps/hash-cleanup' Further code clean-up on the use of hash functions. Now the context object knows what hash function it is working with. * ps/hash-cleanup: global: adapt callers to use generic hash context helpers hash: provide generic wrappers to update hash contexts hash: stop typedeffing the hash context hash: convert hashing context to a structure --- 246569bf83f2a586268d26559c7d6ea54c9316b6 diff --cc pack-write.c index a2faeb1895,cfcb7297b8..d61e29ba4e --- a/pack-write.c +++ b/pack-write.c @@@ -443,8 -436,9 +443,9 @@@ void fixup_pack_header_footer(const str partial_pack_offset -= n; if (partial_pack_offset == 0) { unsigned char hash[GIT_MAX_RAWSZ]; - hash_algo->final_fn(hash, &old_hash_ctx); - if (!hasheq(hash, partial_pack_hash, hash_algo)) + git_hash_final(hash, &old_hash_ctx); + if (!hasheq(hash, partial_pack_hash, - the_repository->hash_algo)) ++ hash_algo)) die("Unexpected checksum for %s " "(disk corruption?)", pack_name); /* @@@ -460,9 -454,9 +461,9 @@@ free(buf); if (partial_pack_hash) - hash_algo->final_fn(partial_pack_hash, &old_hash_ctx); - hash_algo->final_fn(new_pack_hash, &new_hash_ctx); + git_hash_final(partial_pack_hash, &old_hash_ctx); + git_hash_final(new_pack_hash, &new_hash_ctx); - write_or_die(pack_fd, new_pack_hash, the_hash_algo->rawsz); + write_or_die(pack_fd, new_pack_hash, hash_algo->rawsz); fsync_component_or_die(FSYNC_COMPONENT_PACK, pack_fd, pack_name); }