public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] midx-write.c: assume checksum-invalid MIDXs require an update
Date: Tue, 13 Jan 2026 08:38:23 +0100	[thread overview]
Message-ID: <aWX2b9vj8olYODwc@pks.im> (raw)
In-Reply-To: <952a40c1bef40f5ad2c7f6853f6da64f99350976.1768261435.git.me@ttaylorr.com>

On Mon, Jan 12, 2026 at 06:45:06PM -0500, Taylor Blau wrote:
> diff --git a/midx-write.c b/midx-write.c
> index 87b97c70872..6485cb67068 100644
> --- a/midx-write.c
> +++ b/midx-write.c
> @@ -1011,6 +1011,20 @@ static bool midx_needs_update(struct multi_pack_index *midx, struct write_midx_c
>  	struct strbuf buf = STRBUF_INIT;
>  	bool needed = true;
>  
> +	/*
> +	 * Ensure that we have a valid checksum before consulting the
> +	 * exisiting MIDX in order to determine if we can avoid an
> +	 * update.
> +	 *
> +	 * This is necessary because the given MIDX is loaded directly
> +	 * from the object store (because we still compare our proposed
> +	 * update to any on-disk MIDX regardless of whether or not we
> +	 * have assigned "ctx.m") and is thus not guaranteed to have a
> +	 * valid checksum.
> +	 */
> +	if (!midx_checksum_valid(midx))
> +		goto out;
> +
>  	/*
>  	 * Ignore incremental updates for now. The assumption is that any
>  	 * incremental update would be either empty (in which case we will bail

This looks sensible to me, thanks for the fix!

Patrick

      reply	other threads:[~2026-01-13  7:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 23:44 [PATCH 0/2] midx-write.c: do not optimize out writes with corrupt MIDXs Taylor Blau
2026-01-12 23:45 ` [PATCH 1/2] t/t5319-multi-pack-index.sh: drop early 'test_done' Taylor Blau
2026-01-13  7:37   ` Patrick Steinhardt
2026-01-12 23:45 ` [PATCH 2/2] midx-write.c: assume checksum-invalid MIDXs require an update Taylor Blau
2026-01-13  7:38   ` Patrick Steinhardt [this message]

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=aWX2b9vj8olYODwc@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    /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