Skip to content

Commit 8e7d1f6

Browse files
committed
Merge branch 'np/no-loosen-prune-expire-now' into maint
* np/no-loosen-prune-expire-now: objects to be pruned immediately don't have to be loosened
2 parents 20bd35c + 8e8daf3 commit 8e7d1f6

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Documentation/config.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,9 @@ gc.packrefs::
702702

703703
gc.pruneexpire::
704704
When 'git-gc' is run, it will call 'prune --expire 2.weeks.ago'.
705-
Override the grace period with this config variable.
705+
Override the grace period with this config variable. The value
706+
"now" may be used to disable this grace period and always prune
707+
unreachable objects immediately.
706708

707709
gc.reflogexpire::
708710
'git-reflog expire' removes reflog entries older than

builtin-gc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ static int need_to_gc(void)
188188
* there is no need.
189189
*/
190190
if (too_many_packs())
191-
append_option(argv_repack, "-A", MAX_ADD);
191+
append_option(argv_repack,
192+
!strcmp(prune_expire, "now") ? "-a" : "-A",
193+
MAX_ADD);
192194
else if (!too_many_loose_objects())
193195
return 0;
194196

@@ -243,7 +245,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
243245
"run \"git gc\" manually. See "
244246
"\"git help gc\" for more information.\n");
245247
} else
246-
append_option(argv_repack, "-A", MAX_ADD);
248+
append_option(argv_repack,
249+
!strcmp(prune_expire, "now") ? "-a" : "-A",
250+
MAX_ADD);
247251

248252
if (pack_refs && run_command_v_opt(argv_pack_refs, RUN_GIT_CMD))
249253
return error(FAILED_RUN, argv_pack_refs[0]);

0 commit comments

Comments
 (0)