Should commit-msg hook receive the washed message?
- From
Sean Allred <allred.sean@gmail.com>
- Date
- Jul 5, 2024, 20:12 UTC
- Message-ID
- <m0h6d3pphu.fsf@epic96565.epic.com>
From githooks.txt:
Show 5 quoted lines
> 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