midx-write: put failing response value back

This instance of setting the result to 1 before going to cleanup was accidentally removed in fcb2205b77 (midx: implement support for writing incremental MIDX chains, 2024-08-06). Build upon a test that already deletes a packfile to verify that this error propagates to full command failure. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Sep 5, 2025 at 19:26 UTC 3a45c7beb0f66bad122a1c319c71add5533e1f00
2 files changed +5 -1
midx-write.c
+1
@@ -1122,6 +1122,7 @@ static int write_midx_internal(struct repository *r, const char *object_dir,
1122 m = m->base_midx;
1123 }
1124 } else if (ctx.m && fill_packs_from_midx(&ctx)) {
1125 + result = 1;
1126 goto cleanup;
1127 }
1128
t/t5319-multi-pack-index.sh
+4 -1
@@ -1100,7 +1100,10 @@ test_expect_success 'load reverse index when missing .idx, .pack' '
1100 mv $idx.bak $idx &&
1101
1102 mv $pack $pack.bak &&
1103 - git cat-file --batch-check="%(objectsize:disk)" <tip
1103 + git cat-file --batch-check="%(objectsize:disk)" <tip &&
1104 +
1105 + test_must_fail git multi-pack-index write 2>err &&
1106 + test_grep "could not load pack" err
1107 )
1108 '
1109