git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Don't Call commit-msg Hooks With Empty Commit Messages
@ 2021-09-17  3:37 Kurt von Laven
  2021-09-17  9:42 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Kurt von Laven @ 2021-09-17  3:37 UTC (permalink / raw)
  To: git

Hello,

The most common reason commit messages are left empty is to abort
them. commit-msg hooks that replace empty commit messages with
non-empty ones (i) make it impossible to abort commits, (ii) are
startling to developers joining a project configured in this manner,
and (iii) can offer no value that wouldn't be equally or better
offered another way. For instance, a default commit message would be
better implemented as a commit message template or prepare-commit-msg
hook. I propose that Git eventually cease calling commit-msg hooks
when the commit-message is empty, but I would understand if backwards
compatibility were the overriding concern. On the other hand, the
empty commit message case is easy to overlook when crafting a
commit-msg hook. One consequence of this behavior is that running the
popular pre-commit tool (https://pre-commit.com/) tends to lead to a
spew of false positives to the console on an aborted commit when
configured with commit-msg hooks.

Be well,
Kurt von Laven

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-19  5:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-17  3:37 Don't Call commit-msg Hooks With Empty Commit Messages Kurt von Laven
2021-09-17  9:42 ` Junio C Hamano
2021-09-17 19:27   ` Ævar Arnfjörð Bjarmason
2021-09-17 19:43     ` Junio C Hamano
2021-09-18  9:58       ` Kurt von Laven
2021-09-19  5:06         ` Kurt von Laven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).