When `git gc --auto` would detect need for garbage collection to run, it would just run. With this patch, enabling gc.autowarnonly will instead make it just emit a warning. Reviewed-by: Sverre Rabbelier <srabbelier@xxxxxxxxx> Signed-off-by: Fernando Vezzosi <buccia@xxxxxxxxx> --- builtin/gc.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 0498094..65b6616 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -26,6 +26,7 @@ static int pack_refs = 1; static int aggressive_window = 250; static int gc_auto_threshold = 6700; static int gc_auto_pack_limit = 50; +static int gc_auto_warn_only = 0; static const char *prune_expire = "2.weeks.ago"; #define MAX_ADD 10 @@ -64,6 +65,10 @@ static int gc_config(const char *var, const char *value, void *cb) } return git_config_string(&prune_expire, var, value); } + if (!strcmp(var, "gc.autowarnonly")) { + gc_auto_warn_only = git_config_bool(var, value); + return 0; + } return git_default_config(var, value, cb); } @@ -219,6 +224,15 @@ int cmd_gc(int argc, const char **argv, const char *prefix) */ if (!need_to_gc()) return 0; + + if (gc_auto_warn_only){ + fprintf(stderr, + _("Pack the repository for optimum performance by running\n" + "\"git gc\" manually. See " + "\"git help gc\" for more information.\n")); + return 0; + } + if (quiet) fprintf(stderr, _("Auto packing the repository for optimum performance.\n")); else -- 1.7.5.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html