@matheusbsbs / matheus-bagliano / commits / 8e8daf3363
Fork 0

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>

Nicolas Pitre committed Dec 30, 2008 at 14:45 UTC 8e8daf33632d14f01d342b4f89d8afceecdd606b
2 files changed +9 -3
Documentation/config.txt
+3 -1
@@ -702,7 +702,9 @@ gc.packrefs::
702
703 gc.pruneexpire::
704 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.
708
709 gc.reflogexpire::
710 'git-reflog expire' removes reflog entries older than
builtin-gc.c
+6 -2
@@ -188,7 +188,9 @@ static int need_to_gc(void)
188 * there is no need.
189 */
190 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);
194 else if (!too_many_loose_objects())
195 return 0;
196
@@ -243,7 +245,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
245 "run \"git gc\" manually. See "
246 "\"git help gc\" for more information.\n");
247 } else
246 - append_option(argv_repack, "-A", MAX_ADD);
248 + append_option(argv_repack,
249 + !strcmp(prune_expire, "now") ? "-a" : "-A",
250 + MAX_ADD);
251
252 if (pack_refs && run_command_v_opt(argv_pack_refs, RUN_GIT_CMD))
253 return error(FAILED_RUN, argv_pack_refs[0]);