Skip to content

Commit

Permalink
Merge branch 'np/no-loosen-prune-expire-now' into maint
Browse files Browse the repository at this point in the history
* np/no-loosen-prune-expire-now:
  objects to be pruned immediately don't have to be loosened
  • Loading branch information
Junio C Hamano committed Jan 29, 2009
2 parents 20bd35c + 8e8daf3 commit 8e7d1f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,9 @@ gc.packrefs::

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

gc.reflogexpire::
'git-reflog expire' removes reflog entries older than
Expand Down
8 changes: 6 additions & 2 deletions builtin-gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ static int need_to_gc(void)
* there is no need.
*/
if (too_many_packs())
append_option(argv_repack, "-A", MAX_ADD);
append_option(argv_repack,
!strcmp(prune_expire, "now") ? "-a" : "-A",
MAX_ADD);
else if (!too_many_loose_objects())
return 0;

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

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

0 comments on commit 8e7d1f6

Please sign in to comment.