Jeff King <peff@xxxxxxxx> writes: >> If there is an out-of-band guarantee that .kept packs won't refer to >> outside world, then we can obtain identical results to what existing >> --honor-pack-keep (which traverses everything and then filteres out >> what is in .keep pack) does by just stopping traversal when we see >> an object that is found in a .keep pack. OK, I guess that it >> answers the correctness question I asked about [02/10]. >> >> It still is curious how we can safely "assume", but presumably we >> will see how in a patch that appears later in the series. > > I think this would generally happen if the .keep packs are generated > using something like "git repack -a", which packs everything reachable > together. So if you do: > > git repack -ad > touch .git/objects/pack/pack-whatever.keep > ... some more packs come in, perhaps via pushes ... > # imagine repack knew how to pass this along... > git repack -a --assume-kept-packs-closed > > then you'd repack just the objects that aren't in the big pack. Yeah. As a tool to help the above workflow, where you are only creating another .keep out of youngest objects (i.e. those that are either loose or in non-kept packs), because by definition anything in .keep cannot be pointing back at these younger objects, it does make sense to take advantage of "the set of packs with .keep as a whole is closed". It may become tricky once we start talking about creating a new .keep out of youngest objects PLUS a few young keep packs, though. Starting from all on-disk .keep packs, you'd mark them as in-core keep bit, then drop in-core keep bit from the few young keep packs that you intend to coalesce with the youngest objects---that is how I would imagine your repacking strategy would go. The set of all the on-disk .keep packs may give us "closed" guarantee, but if we exclude a few latest packs from that set, would the remainder still give us the "closed" guarantee we can take advantage of, in order to pack these youngest objects (including the ones in the kept packs that we are coalescing)?