Re: [PATCH 3/3] templates: detect messages that contain a separator line
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 9, 2026, 00:17 UTC
- Message-ID
- <xmqqzf5i7otb.fsf@gitster.g>
- In-Reply-To
- <32614598-48f0-4e3d-ba8c-e8d96b71dbd9@app.fastmail.com>
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
Show 9 quoted lines
>> A saving grace is that when the user is stopped with this, >> pre-commit hook that inspects the contents to be committed >> have already run successfully, so rerunning with "--no-verify" >> is not with too much risk. But still, I am not sure if this is a >> good thing to do overall. > > Maybe this is not the right tool[1] but perhaps the hook could respect > an env. variable to disable this check and hint about it in the error > output?
It is merely a sample script shipped with the rest of Git, so people can choose to install better alternatives. I think it is fine to keep the sample script simple and understandable.
It however is still a little worrysome that the behaviour of the sample commit-msg hook updated with the third patch may be used against helpful suggestions people in projects that employ the e-mail based workflow may make to their colleages to deliberately commit a three-dash line followed by material not meant for the commit log proper, which is a useful trick if you are making your commits to be sent over e-mail and never to be merged directly to your target branch.