From 2ade806cf5740fa0ef0f7211699e5b4e7ce90464 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 20 Oct 2011 17:26:01 +0200 Subject: maint: add git hook scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We find it worthwhile to use consistent commit summary prefixes. To that end, the commit-msg script requires that all commits I make start with "$P: " (where $P is one of ~100 programs in coreutils) or one of a few other words, like gnulib tests maint doc build. It allows more than one word, so e.g., "cat tail head: " would also be accepted. Pádraig Brady wrote the initial version, with its 72-column and blank-if-present second line checks. The pre-commit script is the same as the git-supplied sample script, modulo a bug fix and the "exec 1>&2" redirection. * scripts/git-hooks/commit-msg: New file. * scripts/git-hooks/pre-commit: New file. * scripts/git-hooks/applypatch-msg: New file. Verbatim from .sample. * cfg.mk: Exempt two of the new scripts from the no-leading-TABs check, since they're nearly verbatim from git, and we want to stay in sync. Exempt the commit-msg script from the no-"fail=0" check. --- scripts/git-hooks/applypatch-msg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/git-hooks/applypatch-msg (limited to 'scripts/git-hooks/applypatch-msg') diff --git a/scripts/git-hooks/applypatch-msg b/scripts/git-hooks/applypatch-msg new file mode 100755 index 000000000..8b2a2fe84 --- /dev/null +++ b/scripts/git-hooks/applypatch-msg @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +test -x "$GIT_DIR/hooks/commit-msg" && + exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"} +: -- cgit v1.2.3