Merge branch 'zh/gc-expire-to'
"git gc" learned the "--expire-to" option and passes it down to underlying "git repack". * zh/gc-expire-to: gc: add `--expire-to` option
This commit is contained in:
@ -139,6 +139,7 @@ struct gc_config {
|
||||
char *prune_worktrees_expire;
|
||||
char *repack_filter;
|
||||
char *repack_filter_to;
|
||||
char *repack_expire_to;
|
||||
unsigned long big_pack_threshold;
|
||||
unsigned long max_delta_cache_size;
|
||||
/*
|
||||
@ -445,7 +446,8 @@ static int keep_one_pack(struct string_list_item *item, void *data UNUSED)
|
||||
static void add_repack_all_option(struct gc_config *cfg,
|
||||
struct string_list *keep_pack)
|
||||
{
|
||||
if (cfg->prune_expire && !strcmp(cfg->prune_expire, "now"))
|
||||
if (cfg->prune_expire && !strcmp(cfg->prune_expire, "now")
|
||||
&& !(cfg->cruft_packs && cfg->repack_expire_to))
|
||||
strvec_push(&repack, "-a");
|
||||
else if (cfg->cruft_packs) {
|
||||
strvec_push(&repack, "--cruft");
|
||||
@ -454,6 +456,8 @@ static void add_repack_all_option(struct gc_config *cfg,
|
||||
if (cfg->max_cruft_size)
|
||||
strvec_pushf(&repack, "--max-cruft-size=%lu",
|
||||
cfg->max_cruft_size);
|
||||
if (cfg->repack_expire_to)
|
||||
strvec_pushf(&repack, "--expire-to=%s", cfg->repack_expire_to);
|
||||
} else {
|
||||
strvec_push(&repack, "-A");
|
||||
if (cfg->prune_expire)
|
||||
@ -688,7 +692,6 @@ struct repository *repo UNUSED)
|
||||
const char *prune_expire_sentinel = "sentinel";
|
||||
const char *prune_expire_arg = prune_expire_sentinel;
|
||||
int ret;
|
||||
|
||||
struct option builtin_gc_options[] = {
|
||||
OPT__QUIET(&quiet, N_("suppress progress reporting")),
|
||||
{ OPTION_STRING, 0, "prune", &prune_expire_arg, N_("date"),
|
||||
@ -707,6 +710,8 @@ struct repository *repo UNUSED)
|
||||
PARSE_OPT_NOCOMPLETE),
|
||||
OPT_BOOL(0, "keep-largest-pack", &keep_largest_pack,
|
||||
N_("repack all other packs except the largest pack")),
|
||||
OPT_STRING(0, "expire-to", &cfg.repack_expire_to, N_("dir"),
|
||||
N_("pack prefix to store a pack containing pruned objects")),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user