summaryrefslogtreecommitdiff
path: root/builtin-gc.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-12-30 19:45:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-01 12:51:51 (GMT)
commit8e8daf33632d14f01d342b4f89d8afceecdd606b (patch)
tree4408763d1d4968d162d6d946fb33abd2fee0ea6b /builtin-gc.c
parent936b7057e8401665a2d106e8de018561db6333fe (diff)
downloadgit-8e8daf33632d14f01d342b4f89d8afceecdd606b.zip
git-8e8daf33632d14f01d342b4f89d8afceecdd606b.tar.gz
git-8e8daf33632d14f01d342b4f89d8afceecdd606b.tar.bz2
objects to be pruned immediately don't have to be loosened
When there is no grace period before pruning unreferenced objects, it is pointless to push those objects in their loose form just to delete them right away. Also be more explicit about the possibility of using "now" in the gc.pruneexpire config variable (needed for the above behavior to happen). Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-gc.c')
-rw-r--r--builtin-gc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin-gc.c b/builtin-gc.c
index 781df60..f8eae4a 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -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;
@@ -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]);