]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/repack.c: extract redundant pack cleanup for existing packs
authorTaylor Blau <me@ttaylorr.com>
Wed, 13 Sep 2023 19:17:51 +0000 (15:17 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Sep 2023 19:32:47 +0000 (12:32 -0700)
commitf2d3bf178aaf4e590f3618d657e14aceb44514f0
treef81570d8f64336b566bb7e20eecb2c162900e929
parent639c4a3992337e15c0faa2fa6d73462cc76ca7b9
builtin/repack.c: extract redundant pack cleanup for existing packs

To remove redundant packs at the end of a repacking operation, Git uses
its `remove_redundant_pack()` function in a loop over the set of
pre-existing, non-kept packs.

In a later commit, we will split this list into two, one for
pre-existing cruft pack(s), and another for non-cruft pack(s). Prepare
for this by factoring out the routine to loop over and delete redundant
packs into its own function.

Instead of calling `remove_redundant_pack()` directly, we now will call
`remove_redundant_existing_packs()`, which itself dispatches a call to
`remove_redundant_packs_1()`. Note that the geometric repacking code
will still call `remove_redundant_pack()` directly, but see the previous
commit for more details.

Having `remove_redundant_packs_1()` exist as a separate function may
seem like overkill in this patch. However, a later patch will call
`remove_redundant_packs_1()` once over two separate lists, so this
refactoring sets us up for that.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c