Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Patrick Steinhardt <ps@pks.im>,  friel@openai.com,  git@vger.kernel.org
Subject: Re: [PATCH v2] pack-objects: trace pack bytes written
Date: Thu, 20 Aug 2026 08:35:04 -0700	[thread overview]
Message-ID: <xmqq4igou7o7.fsf@gitster.g> (raw)
In-Reply-To: <20260820082102.GA2973952@coredump.intra.peff.net> (Jeff King's message of "Thu, 20 Aug 2026 04:21:02 -0400")

Jeff King <peff@peff.net> 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.


  parent reply	other threads:[~2026-08-20 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 23:39 [PATCH] pack-objects: trace pack bytes written friel
2026-08-18  1:08 ` Junio C Hamano
2026-08-19 23:28   ` [PATCH v2] " friel
2026-08-20  5:41     ` Patrick Steinhardt
2026-08-20  8:21       ` Jeff King
2026-08-20  9:13         ` Patrick Steinhardt
2026-08-21  0:40           ` Jeff King
2026-08-21  3:33             ` Junio C Hamano
2026-08-20 15:35         ` Junio C Hamano [this message]
2026-08-21  0:47     ` Jeff King
2026-08-21  3:33       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4igou7o7.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=friel@openai.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox