aboutsummaryrefslogtreecommitdiff
path: root/midx-write.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-01-21 16:16:27 -0800
committerJunio C Hamano <gitster@pobox.com>2026-01-21 16:16:27 -0800
commite13de9ed8ea8a6aedfb3e0c0a0c4e914db82355a (patch)
tree2d5888a77101b218c655112372b55724c8220925 /midx-write.c
parent070fa416755497ce78e09713ef5cd37e2c7205f2 (diff)
parent38b72e581513dfbef784a1b808d282df1e0504d2 (diff)
downloadgit-e13de9ed8ea8a6aedfb3e0c0a0c4e914db82355a.tar.xz
Merge branch 'tb/midx-write-corrupt-checksum-fix'
The logic that avoids reusing MIDX files with a wrong checksum was broken, which has been corrected. * tb/midx-write-corrupt-checksum-fix: midx-write.c: assume checksum-invalid MIDXs require an update t/t5319-multi-pack-index.sh: drop early 'test_done'
Diffstat (limited to 'midx-write.c')
-rw-r--r--midx-write.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/midx-write.c b/midx-write.c
index 87b97c7087..6485cb6706 100644
--- a/midx-write.c
+++ b/midx-write.c
@@ -1012,6 +1012,20 @@ static bool midx_needs_update(struct multi_pack_index *midx, struct write_midx_c
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
* out later) or it would actually cover at least one new pack.