git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Allred <allred.sean@gmail.com>
To: Git mailing list <git@vger.kernel.org>
Subject: Should commit-msg hook receive the washed message?
Date: Fri, 05 Jul 2024 15:12:29 -0500	[thread overview]
Message-ID: <m0h6d3pphu.fsf@epic96565.epic.com> (raw)

From githooks.txt:
> This hook is invoked by linkgit:git-commit[1] and
> linkgit:git-merge[1], and can be bypassed with the `--no-verify`
> option. It takes a single parameter, the name of the file that holds
> the proposed commit log message. Exiting with a non-zero status causes
> the command to abort.

Of course the actual 'proposed commit log message' doesn't include the
comments included when running a commit, e.g.

    git -c commit.status=true commit

but the execution of the `commit-msg` happens before `cleanup_message`
is called on COMMIT_EDITMSG.

This seems like a bug to me; is there something I'm missing? I would
propose adding a call to `cleanup_message` (with the appropriate
arguments) inside `prepare_to_commit` right before `commit-msg` is
invoked.

It's causing us quite a bit of grief (e.g. with external tools that
invoke hooks incorrectly [1] + some other internal workarounds for
things like patch scissors).

Thanks,
-Sean

[1]: https://lore.kernel.org/git/17df67804ef7a3c8.df629cdadcf4ea15.524a056283063601@EPIC94403/

-- 
Sean Allred

             reply	other threads:[~2024-07-05 20:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05 20:12 Sean Allred [this message]
2024-07-05 21:35 ` Should commit-msg hook receive the washed message? Eric Sunshine
2024-07-06  6:37   ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2024-07-05 22:07 brianmlyles

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=m0h6d3pphu.fsf@epic96565.epic.com \
    --to=allred.sean@gmail.com \
    --cc=git@vger.kernel.org \
    /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).