Thread (1 message) 1 message, 1 author, 2025-05-22

Re: [PATCH v2 2/2] midx: stop repeatedly looking up nonexistent packfiles

From: Junio C Hamano <hidden>
Date: 2025-05-22 18:44:47

Jeff King [off-list ref] writes:
But back in the caller...
quoted
	p = m->packs[pack_int_id - m->num_packs_in_base];
...
Our pack_int_id is the global one, so it needs to be adjusted. But this
pack pointer we access is the same one that was filled (or not) by
prepare_midx_pack(). So it cannot be NULL or the magic "fails" value,
because prepare_midx_pack() returned 0.

So I think this code is fine.
Ahh, I missed that call to midx_for_pack() in prepare_midx_pack()
that modifies pack_int_id variable.  Of course, it did not help that
the implementation detail of adjusting by m->num_packs_in_base which
is done in midx_for_pack() is not abstracted out and the caller needs
to do the same as above.  That confused me.

Thanks for an explanation.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help