Subject: Re: [PATCH v2 08/18] midx-write.c: don't use `pack_perm` when assigning `bitmap_pos`

From: Junio C Hamano <[email-masked]>
Date: Wed, 14 Jan 2026 13:13:17 -0800

Taylor Blau <[email-masked]> writes:

> But the process is completely unnecessary in the first place: we are
> enumerating all values of `ctx->info`, and there is no reason to process
> them in a different order than they appear in memory. Index `ctx->info`
> directly to reflect that.

As long as pack_perm[] is permutations of [0..ctx->nr-1], it does
not matter, as we are clearing all the [0..ctx->nr-1] range anyway,
in other words?

>
> Signed-off-by: Taylor Blau <[email-masked]>
> ---
>  midx-write.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/midx-write.c b/midx-write.c
> index 13171d7e9c4..da9c5a7c295 100644
> --- a/midx-write.c
> +++ b/midx-write.c
> @@ -637,7 +637,7 @@ static uint32_t *midx_pack_order(struct write_midx_context *ctx)
>  		pack_order[i] = data[i].nr;
>  	}
>  	for (i = 0; i < ctx->nr; i++) {
> -		struct pack_info *pack = &ctx->info[ctx->pack_perm[i]];
> +		struct pack_info *pack = &ctx->info[i];
>  		if (pack->bitmap_pos == BITMAP_POS_UNKNOWN)
>  			pack->bitmap_pos = 0;
>  	}