On Tue, Aug 25, 2020 at 01:10:13PM -0400, Derrick Stolee wrote: > > If we do care, though, that implies some cooperation between the > > deletion process and the midx code. Perhaps it even argues that repack > > should refuse to delete such a single pack at all, since it _isn't_ > > redundant. It's part of a midx, and the caller should rewrite the midx > > first itself, and _then_ look for redundant packs. > > It is worth noting that we _do_ have a way to integrate the delete and > write code using 'git multi-pack-index expire'. One way to resolve this > atomicity would be to do the following inside the repack command: > > 1. Create and index the new pack. > 2. git multi-pack-index write > 3. git multi-pack-index expire Given that discussion elsewhere points to git-repack only really deleting packs in all-in-one mode (and not ever a single pack), it seems like we can really be much simpler here. If we're not deleting packs via all-in-one, there's no need to touch the midx at all. If we are, then it's reasonable to delete the midx immediately (after having written our new pack but before deleting) since our new single pack idx is as good or better. I.e., drop step 2 above, and make step 3 just clear_midx_file(). Which is roughly what the code does now, isn't it? Or is there some reason that "expire" is more interesting than just clearing? And if anybody does want to drop single packs, etc, they can do so by generating a sensible midx separately from the repack operation (and probably doing so before dropping the packs for atomicity). -Peff