From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Kurt von Laven <kurt.von.laven@gmail.com>, git@vger.kernel.org
Subject: Re: Don't Call commit-msg Hooks With Empty Commit Messages
Date: Fri, 17 Sep 2021 12:43:57 -0700 [thread overview]
Message-ID: <xmqqmtobgf7m.fsf@gitster.g> (raw)
In-Reply-To: <874kajdmsh.fsf@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Fri, 17 Sep 2021 21:27:13 +0200")
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> I'd think we'd want to call it on an empty message, e.g. maybe someone
> depends on that with empty message = auto-generate a message for me.
I tend to agree with you that, especially if we are to keep the
"commit-msg hook is allowed to change the message, even though it is
a job for other hooks", we should invoke it even on an empty file.
> But for those that don't, doesn't the default behavior of "git commit"
> catch this in either case, i.e. it wouldn't let it pass without
> --allow-empty-message.
>
> I understood this report as the hook taking the empty message (e.g. the
> user using it as a shorthand to abort), and their hook "helpfully"
> inserting some "default" message or template.
My understanding largely overlaps with yours but with some
differences.
They do not fall into either of the two camps. Their hook does futz
with the message indiscriminately and adds some boilerplate material
blindly, even to an empty file.
The complaint is "the message is otherwise without any substance,
but because the hook blindly added some boilerplate material into
the empty original, it appears to be non-empty and fails to trigger
the --no-allow-empty-message machinery."
next prev parent reply other threads:[~2021-09-17 19:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-09-18 9:58 ` Kurt von Laven
2021-09-19 5:06 ` Kurt von Laven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqmtobgf7m.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=kurt.von.laven@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).