git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] Allow --no-verify to bypass commit-msg hook

From
Wincent Colaiuta <win@wincent.com>
Date
Dec 8, 2007, 11:38 UTC
Message-ID
<1197113889-16243-2-git-send-email-win@wincent.com>
In-Reply-To
<1197113889-16243-1-git-send-email-win@wincent.com>

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>
---
 builtin-commit.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 2ec8223..df9377e 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -791,7 +791,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);
 	}
-- 
1.5.3.7.1115.gaa595
Previous: Wincent ColaiutaNext: Wincent Colaiuta
Message 2 of 8 in “builtin-commit fixes”
  1. 0/3 builtin-commit fixesWincent Colaiuta, Dec 8, 2007
  2. 1/3 Allow --no-verify to bypass commit-msg hookWincent Colaiuta, Dec 8, 2007
  3. 2/3 Documentation: fix --no-verify documentation for "git commit"Wincent Colaiuta, Dec 8, 2007
  4. 3/3 Fix commit-msg hook to allow editingWincent Colaiuta, Dec 8, 2007
  5. Junio C HamanoDec 9, 2007
  6. Wincent ColaiutaDec 9, 2007
  7. 4/4 Add tests for pre-commit and commit-msg hooksWincent Colaiuta, Dec 8, 2007
  8. Wincent ColaiutaDec 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.