midx-write.c: enumerate `pack_int_id` values directly

Our `midx-write.c::fill_packs_from_midx()` function currently enumerates the range [0, m->num_packs), and then shifts its index variable up by `m->num_packs_in_base` to produce a valid `pack_int_id`. Instead, directly enumerate the range: [m->num_packs_in_base, m->num_packs_in_base + m->num_packs) , which are the original pack_int_ids themselves as opposed to the indexes of those packs relative to the MIDX layer they are contained within. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Feb 24, 2026 at 14:00 UTC 93c67df7511057e7c8fda169671a44322c04c2d0
1 file changed +3 -3
midx-write.c
+3 -3
@@ -935,11 +935,11 @@ static int fill_packs_from_midx(struct write_midx_context *ctx)
935 for (m = ctx->m; m; m = m->base_midx) {
936 uint32_t i;
937
938 - for (i = 0; i < m->num_packs; i++) {
938 + for (i = m->num_packs_in_base;
939 + i < m->num_packs_in_base + m->num_packs; i++) {
940 ALLOC_GROW(ctx->info, ctx->nr + 1, ctx->alloc);
941
941 - if (fill_pack_from_midx(&ctx->info[ctx->nr], m,
942 - m->num_packs_in_base + i) < 0)
942 + if (fill_pack_from_midx(&ctx->info[ctx->nr], m, i) < 0)
943 return -1;
944
945 ctx->nr++;