Skip to content

Commit 9574e8f

Browse files
ttaylorrgitster
authored andcommitted
builtin/repack.c: pass "packdir" when removing packs
builtin/repack.c defines a static "packdir" to instruct pack-objects on where to write any new packfiles. This is also the directory scanned when removing any packfiles which were made redundant by the latest repack. Prepare to move the "existing_packs_remove_redundant" function to its own compilation unit by passing in this information as a parameter to that function. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f905f49 commit 9574e8f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

builtin/repack.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ static void existing_packs_mark_for_deletion(struct existing_packs *existing,
209209
}
210210

211211
static void remove_redundant_packs_1(struct repository *repo,
212-
struct string_list *packs)
212+
struct string_list *packs,
213+
const char *packdir)
213214
{
214215
struct string_list_item *item;
215216
for_each_string_list_item(item, packs) {
@@ -219,10 +220,13 @@ static void remove_redundant_packs_1(struct repository *repo,
219220
}
220221
}
221222

222-
static void existing_packs_remove_redundant(struct existing_packs *existing)
223+
static void existing_packs_remove_redundant(struct existing_packs *existing,
224+
const char *packdir)
223225
{
224-
remove_redundant_packs_1(existing->repo, &existing->non_kept_packs);
225-
remove_redundant_packs_1(existing->repo, &existing->cruft_packs);
226+
remove_redundant_packs_1(existing->repo, &existing->non_kept_packs,
227+
packdir);
228+
remove_redundant_packs_1(existing->repo, &existing->cruft_packs,
229+
packdir);
226230
}
227231

228232
static void existing_packs_release(struct existing_packs *existing)
@@ -1659,7 +1663,7 @@ int cmd_repack(int argc,
16591663

16601664
if (delete_redundant) {
16611665
int opts = 0;
1662-
existing_packs_remove_redundant(&existing);
1666+
existing_packs_remove_redundant(&existing, packdir);
16631667

16641668
if (geometry.split_factor)
16651669
geometry_remove_redundant_packs(&geometry, &names,

0 commit comments

Comments
 (0)