Skip to content

Commit cad0632

Browse files
ttaylorrgitster
authored andcommitted
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>
1 parent 9ced91c commit cad0632

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

midx-write.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,11 +932,11 @@ static int fill_packs_from_midx(struct write_midx_context *ctx)
932932
for (m = ctx->m; m; m = m->base_midx) {
933933
uint32_t i;
934934

935-
for (i = 0; i < m->num_packs; i++) {
935+
for (i = m->num_packs_in_base;
936+
i < m->num_packs_in_base + m->num_packs; i++) {
936937
ALLOC_GROW(ctx->info, ctx->nr + 1, ctx->alloc);
937938

938-
if (fill_pack_from_midx(&ctx->info[ctx->nr], m,
939-
m->num_packs_in_base + i) < 0)
939+
if (fill_pack_from_midx(&ctx->info[ctx->nr], m, i) < 0)
940940
return -1;
941941

942942
ctx->nr++;

0 commit comments

Comments
 (0)