[PATCH 2/4] git-gc: add a --no-verify option to bypass the pre-auto-gc hook
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
Documentation/git-gc.txt | 4 ++++
builtin-gc.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-gc.txt b/Documentation/git-gc.txt
index d424a4e..396da5c 100644
--- a/Documentation/git-gc.txt
+++ b/Documentation/git-gc.txt
@@ -62,6 +62,10 @@ automatic consolidation of packs.
--quiet::
Suppress all progress reports.
+--no-verify::
+ This option bypasses the pre-auto-gc hook.
+ See also link:hooks.html[hooks].
+
Configuration
-------------
diff --git a/builtin-gc.c b/builtin-gc.c
index acd63be..1eca6b2 100644
--- a/builtin-gc.c
+++ b/builtin-gc.c
@@ -27,6 +27,7 @@ static int aggressive_window = -1;
static int gc_auto_threshold = 6700;
static int gc_auto_pack_limit = 50;
static char *prune_expire = "2.weeks.ago";
+static int no_verify;
#define MAX_ADD 10
static const char *argv_pack_refs[] = {"pack-refs", "--all", "--prune", NULL};
@@ -196,7 +197,7 @@ static int need_to_gc(void)
else if (!too_many_loose_objects())
return 0;
- if (run_hook())
+ if (!no_verify && run_hook())
return 0;
return 1;
}
@@ -214,6 +215,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN(0, "aggressive", &aggressive, "be more thorough (increased runtime)"),
OPT_BOOLEAN(0, "auto", &auto_gc, "enable auto-gc mode"),
OPT_BOOLEAN('q', "quiet", &quiet, "suppress progress reports"),
+ OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-auto-gc hook"),
OPT_END()
};
--
1.5.5.rc2.4.g283c6