Allow --no-verify to bypass commit-msg hook
authorWincent Colaiuta <win@wincent.com>
Sat, 8 Dec 2007 11:38:07 +0000 (12:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Dec 2007 08:55:54 +0000 (00:55 -0800)
At the moment the --no-verify switch to "git commit" instructs it to
skip over the pre-commit hook. Here we teach "git commit --no-verify"
to skip over the commit-msg hook as well. This brings the behaviour
of builtin-commit back in line with git-commit.sh.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c

index 19297ac027ab88ffe01d4b9b5dc12c7ae556f6c1..2032ca314c1c7d9b6fd45128bb30bfe2c36f1792 100644 (file)
@@ -792,7 +792,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                rollback_index_files();
                die("could not read commit message");
        }
-       if (run_hook(index_file, "commit-msg", git_path(commit_editmsg))) {
+       if (!no_verify &&
+           run_hook(index_file, "commit-msg", git_path(commit_editmsg))) {
                rollback_index_files();
                exit(1);
        }