Merge branch 'tb/midx-write-corrupt-checksum-fix' into jch

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'
This commit is contained in:
Junio C Hamano 2026-01-19 16:44:16 -08:00
commit 1a0f5d139a
2 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -415,8 +415,6 @@ test_expect_success 'up-to-date multi-pack-index is retained' '
)
'
test_done
test_expect_success 'verify multi-pack-index success' '
git multi-pack-index verify --object-dir=$objdir
'