@@ -139,6 +139,7 @@ struct gc_config {
139139 char * prune_worktrees_expire ;
140140 char * repack_filter ;
141141 char * repack_filter_to ;
142+ char * repack_expire_to ;
142143 unsigned long big_pack_threshold ;
143144 unsigned long max_delta_cache_size ;
144145 /*
@@ -445,7 +446,8 @@ static int keep_one_pack(struct string_list_item *item, void *data UNUSED)
445446static void add_repack_all_option (struct gc_config * cfg ,
446447 struct string_list * keep_pack )
447448{
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 ))
449451 strvec_push (& repack , "-a" );
450452 else if (cfg -> cruft_packs ) {
451453 strvec_push (& repack , "--cruft" );
@@ -454,6 +456,8 @@ static void add_repack_all_option(struct gc_config *cfg,
454456 if (cfg -> max_cruft_size )
455457 strvec_pushf (& repack , "--max-cruft-size=%lu" ,
456458 cfg -> max_cruft_size );
459+ if (cfg -> repack_expire_to )
460+ strvec_pushf (& repack , "--expire-to=%s" , cfg -> repack_expire_to );
457461 } else {
458462 strvec_push (& repack , "-A" );
459463 if (cfg -> prune_expire )
@@ -688,7 +692,6 @@ struct repository *repo UNUSED)
688692 const char * prune_expire_sentinel = "sentinel" ;
689693 const char * prune_expire_arg = prune_expire_sentinel ;
690694 int ret ;
691-
692695 struct option builtin_gc_options [] = {
693696 OPT__QUIET (& quiet , N_ ("suppress progress reporting" )),
694697 { OPTION_STRING , 0 , "prune" , & prune_expire_arg , N_ ("date" ),
@@ -707,6 +710,8 @@ struct repository *repo UNUSED)
707710 PARSE_OPT_NOCOMPLETE ),
708711 OPT_BOOL (0 , "keep-largest-pack" , & keep_largest_pack ,
709712 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" )),
710715 OPT_END ()
711716 };
712717
0 commit comments