Re: [PATCH v2 08/18] midx-write.c: don't use `pack_perm` when assigning `bitmap_pos`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 14, 2026, 21:13 UTC
- Message-ID
- <xmqq4iongaoi.fsf@gitster.g>
- In-Reply-To
- <315a0ea2985894f5ae5f166bdd1685ce0981fb23.1768420450.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> 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?
Show 19 quoted lines
>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
> 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;
> }