From: Junio C Hamano Date: Tue, 05 Feb 2008 03:08:45 GMT Subject: Re: [PATCH 4/4] git-commit: add a prepare-commit-msg hook Message-ID: <7vk5lkgkw2.fsf@gitster.siamese.dyndns.org> In-Reply-To: <5840dd34338023e3af8446241a63927d18772f62.1200933409.git.bonzini@gnu.org> Paolo Bonzini writes: > It takes two parameters. The first is the source of the commit > message, and can be: `message` (if a `\-m` or `\-F` option was > given); `template` (if a `\-t` option was given or the > configuration option `commit.template` is set); `merge` (if the > commit is a merge or a `.git/MERGE_MSG file exists); `squash` > (if a `.git/SQUASH_MSG file exists); or a commit id (if a > `\-c`, `\-C` or `\--amend` option was given). The second > parameter if the name of the file that the commit log message. Please do without funny mark-ups. The commit log is not AsciiDoc. > The hook is not suppressed by the `\--no-verify` option. However, > exiting with non-zero status only aborts the commit if said option > is not given to `git-commit`. I do not understand why. I do understand that you do not want to bypass prepare-commit-msg with or without --no-verify, because this hook is not about input validation but about input preparation. But I do not understand why a failure exit from it should be treated any differently with or without --no-verify? If you want to be strict and be safe catching a breakage in the prepare-commit-msg hook, you should always abort. You could also choose to ignore. In either case, shouldn't the validation be left to pre-commit hook (for the tree) and commit-msg hook (for the message, that is left after this hook)? > While the default hook just adds a Signed-Off-By line at the bottom It's "s/[OB]/ob/;", and ... > of the commit messsage, the hook is more intended to build a template > for the commit message following project standards, that the user > can then edit or discard altogether. > > Signed-off-by: Paolo Bonzini ... you know it ;-)