Thread (5 messages) flat view 5 messages, 2 authors, 2026-01-13

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

From: Patrick Steinhardt <hidden>
Date: 2026-01-13 07:38:28

On Mon, Jan 12, 2026 at 06:45:06PM -0500, Taylor Blau wrote:
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help