diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-02-12 10:08:53 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-12 10:08:53 -0800 |
| commit | 5b9d01bc4d84a1e09087a0b9dad206e855f49bf2 (patch) | |
| tree | beec49818ba34f8244b5e8c4d71b5b02cb08ccf6 /builtin/gc.c | |
| parent | a4af0b6288e25eb327ae9018cee09def9e43f1cd (diff) | |
| parent | 08032fa30fefa3101bec4b774e79f4d091b516a6 (diff) | |
| download | git-5b9d01bc4d84a1e09087a0b9dad206e855f49bf2.tar.gz | |
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
Diffstat (limited to 'builtin/gc.c')
| -rw-r--r-- | builtin/gc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 0bf3533494..409d454a4b 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -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() }; |
