mbox series

[0/8] repack: refactor pack snapshot-ing logic

Message ID cover.1693946195.git.me@ttaylorr.com (mailing list archive)
Headers show
Series repack: refactor pack snapshot-ing logic | expand

Message

Taylor Blau Sept. 5, 2023, 8:36 p.m. UTC
This series refactors some of the 'git repack' internals to keep track
of existing packs in a set of string lists stored in a single structure,
instead of passing around multiple string lists to different functions
throughout the various paths.

The result is that the interface around pack deletion, marking packs as
redundant, and handling the set of pre-existing packs (both kept and
non-kept) is significantly cleaner without introducing any functional
changes.

I didn't mean to produce so much churn when I started writing these
patches, which began as a simple effort to rename a couple of variables
for more consistency.

Thanks in advance for your review!

Taylor Blau (8):
  builtin/repack.c: extract structure to store existing packs
  builtin/repack.c: extract marking packs for deletion
  builtin/repack.c: extract redundant pack cleanup for --geometric
  builtin/repack.c: extract redundant pack cleanup for existing packs
  builtin/repack.c: extract `has_existing_non_kept_packs()`
  builtin/repack.c: store existing cruft packs separately
  builtin/repack.c: drop `DELETE_PACK` macro
  builtin/repack.c: extract common cruft pack loop

 builtin/repack.c | 288 ++++++++++++++++++++++++++++-------------------
 1 file changed, 174 insertions(+), 114 deletions(-)

Comments

Jeff King Sept. 7, 2023, 9 a.m. UTC | #1
On Tue, Sep 05, 2023 at 04:36:37PM -0400, Taylor Blau wrote:

> This series refactors some of the 'git repack' internals to keep track
> of existing packs in a set of string lists stored in a single structure,
> instead of passing around multiple string lists to different functions
> throughout the various paths.
> 
> The result is that the interface around pack deletion, marking packs as
> redundant, and handling the set of pre-existing packs (both kept and
> non-kept) is significantly cleaner without introducing any functional
> changes.
> 
> I didn't mean to produce so much churn when I started writing these
> patches, which began as a simple effort to rename a couple of variables
> for more consistency.

These all look pretty reasonable to me. I wasn't quite sure about patch
7 and left some comments there, but all of the options are kind of ugly.
Since it's limited to that one file, it may not be worth spending too
much time or brain-power on trying to polish it further.

-Peff