Re: [PATCH v2] pack-objects: trace pack bytes written
From: Junio C Hamano <hidden>
Date: 2026-08-20 15:35:07
Jeff King [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 4a5fcbe5f5..0fdff72f41 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c@@ -1413,9 +1413,9 @@ static void write_pack_file(void) * If we wrote the wrong number of entries in the * header, rewrite it like in fast-import. */ - + const struct git_hash_algo *algo = f->algop; int fd = finalize_hashfile(f, hash, FSYNC_COMPONENT_PACK, 0); - fixup_pack_header_footer(the_hash_algo, fd, hash, + fixup_pack_header_footer(algo, fd, hash, pack_tmp_name, nr_written, hash, offset); close(fd);... But fixup_pack_header_footer() actually recomputes the hash (as it must if we tweak the header). Right now it does it using the "normal" variant, but we should be able to use the unsafe one (which my diff snippet above would start to do).
I am amused. This is an interesting find. Thanks.