git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] pack-objects: trace pack bytes written

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 20, 2026, 15:35 UTC
Message-ID
<xmqq4igou7o7.fsf@gitster.g>
In-Reply-To
<20260820082102.GA2973952@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 22 quoted lines
> 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.
Previous: Junio C HamanoNext: Jeff King
Message 9 of 11 in “pack-objects: trace pack bytes written”
  1. pack-objects: trace pack bytes writtenfriel@openai.com, Aug 17, 2026
  2. Junio C HamanoAug 18, 2026
  3. pack-objects: trace pack bytes writtenfriel@openai.com, Aug 19, 2026
  4. Patrick SteinhardtAug 20, 2026
  5. Jeff KingAug 20, 2026
  6. Patrick SteinhardtAug 20, 2026
  7. Jeff KingAug 21, 2026
  8. Junio C HamanoAug 21, 2026
  9. Junio C HamanoAug 20, 2026
  10. Jeff KingAug 21, 2026
  11. Junio C HamanoAug 21, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.