From: Junio C Hamano Date: Thu, 20 Aug 2026 15:35:04 GMT Subject: Re: [PATCH v2] pack-objects: trace pack bytes written Message-ID: In-Reply-To: <20260820082102.GA2973952@coredump.intra.peff.net> Jeff King writes: > 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.