On Thu, Dec 07, 2023 at 03:34:52PM -0500, Taylor Blau wrote: > On Thu, Dec 07, 2023 at 02:13:13PM +0100, Patrick Steinhardt wrote: [snip] > > Can't it happen that we have no pack here? In the MIDX-case we skip all > > packs that either do not have a bitmap or are not preferred. So does it > > mean that in reverse, every preferred packfile must have a a bitmap? I'd > > think that to not be true in case bitmaps are turned off. > > It's subtle, but this state is indeed not possible. If we have a MIDX > and it has a bitmap, we know that there is at least one object at least > one pack. > > On the "at least one object front", that check was added in eb57277ba3 > (midx: prevent writing a .bitmap without any objects, 2022-02-09). And > we know that our preferred pack (either explicitly given or the one we > infer automatically) is non-empty, via the check added in 5d3cd09a80 > (midx: reject empty `--preferred-pack`'s, 2021-08-31). > > (As a fun/non-fun aside, looking these up gave me some serious deja-vu > and reminded me of how painful discovering and fixing those bugs was!) > > So we're OK here. We could add a comment which captures what I wrote > above here, but since this is a temporary state (and we're going to > change how we select which packs are reuse candidates in a later patch), > I think it's OK to avoid (but please let me know if you feel differently). Makes sense, thanks for the explanation! Patrick
Attachment:
signature.asc
Description: PGP signature