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

Re: [PATCH 2/2] midx-write.c: assume checksum-invalid MIDXs require an update

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 13, 2026, 07:38 UTC
Message-ID
<aWX2b9vj8olYODwc@pks.im>
In-Reply-To
<952a40c1bef40f5ad2c7f6853f6da64f99350976.1768261435.git.me@ttaylorr.com>
On Mon, Jan 12, 2026 at 06:45:06PM -0500, Taylor Blau wrote:
Show 25 quoted lines
> 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
Previous: Taylor Blau
Message 5 of 5 in “midx-write.c: do not optimize out writes with corrupt MIDXs”
  1. 0/2 midx-write.c: do not optimize out writes with corrupt MIDXsTaylor Blau, Jan 12, 2026
  2. 1/2 t/t5319-multi-pack-index.sh: drop early 'test_done'Taylor Blau, Jan 12, 2026
  3. Patrick SteinhardtJan 13, 2026
  4. 2/2 midx-write.c: assume checksum-invalid MIDXs require an updateTaylor Blau, Jan 12, 2026
  5. Patrick SteinhardtJan 13, 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.