Re: [PATCH 4/4] repack: retain cruft packs in MIDXs containing kept packs
From: Taylor Blau <hidden>
Date: 2026-10-01 03:35:41
On Wed, Sep 30, 2026 at 04:53:11PM -0400, Jeff King wrote:
OK. This makes sense to me, but two questions:
1. Is this going to kick in racily because of the .keep that we
temporarily install during pushes? That could cause unexpected
performance changes in a big repo when the midx sometimes has to
randomly include cruft packs.Excellent point. If we happen to race between repacking and receiving an incoming push, it is certainly not the case that we should have to then thrust the cruft pack onto the MIDX, and defeat the whole point of this series ;-).
2. I'd have thought that the solution would be to treat .keep packs
like other included follow-packs: traverse them in the usual way.
But maybe there are good reasons we didn't do that in the first
place.Yeah, I think that's right. The following round passes excluded kept packs into the geometric repack's traversal using '!' for packs outside the existing MIDX and '^' for those already covered by it. That lets us copy their ancestors out of cruft without copying the kept objects themselves. Non-geometric repacks still conservatively retain cruft, since kept objects may remain untraversed. There is, however, a pre-existing corner case with --pack-kept-objects and a cruft pack that is also kept. Such a pack can enter the MIDX without being traversed. This change doesn't address that case. Handling it cleanly looks more involved, so I'd leave it for a separate follow-up. Thanks, Taylor