Signed-off-by: Fernando Vezzosi <buccia@xxxxxxxxx> --- Rebased Nguyễn's patch on top of mine. builtin/gc.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/builtin/gc.c b/builtin/gc.c index 65b6616..ca620e3 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -25,8 +25,10 @@ static const char * const builtin_gc_usage[] = { static int pack_refs = 1; static int aggressive_window = 250; static int gc_auto_threshold = 6700; +static int gc_warn_auto_threshold = 6600; static int gc_auto_pack_limit = 50; static int gc_auto_warn_only = 0; +static int gc_warn_auto_pack_limit = 45; static const char *prune_expire = "2.weeks.ago"; #define MAX_ADD 10 @@ -51,10 +53,12 @@ static int gc_config(const char *var, const char *value, void *cb) } if (!strcmp(var, "gc.auto")) { gc_auto_threshold = git_config_int(var, value); + gc_warn_auto_threshold = gc_auto_threshold - 100; return 0; } if (!strcmp(var, "gc.autopacklimit")) { gc_auto_pack_limit = git_config_int(var, value); + gc_warn_auto_pack_limit = gc_auto_pack_limit - 5; return 0; } if (!strcmp(var, "gc.pruneexpire")) { @@ -123,7 +127,13 @@ static int too_many_loose_objects(void) } } closedir(dir); - return needed; + if (needed) + return 1; + + auto_threshold = (gc_warn_auto_threshold + 255) / 256; + if (num_loose > auto_threshold) + warning(_("Too many loose objects. \"git gc\" will soon run automatically")); + return 0; } static int too_many_packs(void) @@ -146,7 +156,12 @@ static int too_many_packs(void) */ cnt++; } - return gc_auto_pack_limit <= cnt; + if (gc_auto_pack_limit <= cnt) + return 1; + + if (gc_warn_auto_pack_limit <= cnt) + warning(_("Too many packs, \"git gc\" will soon run automatically.")); + return 0; } static int need_to_gc(void) -- 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