@@ -139,6 +139,7 @@ struct gc_config {
139
139
char * prune_worktrees_expire ;
140
140
char * repack_filter ;
141
141
char * repack_filter_to ;
142
+ char * repack_expire_to ;
142
143
unsigned long big_pack_threshold ;
143
144
unsigned long max_delta_cache_size ;
144
145
/*
@@ -445,7 +446,8 @@ static int keep_one_pack(struct string_list_item *item, void *data UNUSED)
445
446
static void add_repack_all_option (struct gc_config * cfg ,
446
447
struct string_list * keep_pack )
447
448
{
448
- if (cfg -> prune_expire && !strcmp (cfg -> prune_expire , "now" ))
449
+ if (cfg -> prune_expire && !strcmp (cfg -> prune_expire , "now" )
450
+ && !(cfg -> cruft_packs && cfg -> repack_expire_to ))
449
451
strvec_push (& repack , "-a" );
450
452
else if (cfg -> cruft_packs ) {
451
453
strvec_push (& repack , "--cruft" );
@@ -454,6 +456,8 @@ static void add_repack_all_option(struct gc_config *cfg,
454
456
if (cfg -> max_cruft_size )
455
457
strvec_pushf (& repack , "--max-cruft-size=%lu" ,
456
458
cfg -> max_cruft_size );
459
+ if (cfg -> repack_expire_to )
460
+ strvec_pushf (& repack , "--expire-to=%s" , cfg -> repack_expire_to );
457
461
} else {
458
462
strvec_push (& repack , "-A" );
459
463
if (cfg -> prune_expire )
@@ -688,7 +692,6 @@ struct repository *repo UNUSED)
688
692
const char * prune_expire_sentinel = "sentinel" ;
689
693
const char * prune_expire_arg = prune_expire_sentinel ;
690
694
int ret ;
691
-
692
695
struct option builtin_gc_options [] = {
693
696
OPT__QUIET (& quiet , N_ ("suppress progress reporting" )),
694
697
{ OPTION_STRING , 0 , "prune" , & prune_expire_arg , N_ ("date" ),
@@ -707,6 +710,8 @@ struct repository *repo UNUSED)
707
710
PARSE_OPT_NOCOMPLETE ),
708
711
OPT_BOOL (0 , "keep-largest-pack" , & keep_largest_pack ,
709
712
N_ ("repack all other packs except the largest pack" )),
713
+ OPT_STRING (0 , "expire-to" , & cfg .repack_expire_to , N_ ("dir" ),
714
+ N_ ("pack prefix to store a pack containing pruned objects" )),
710
715
OPT_END ()
711
716
};
712
717
0 commit comments