On 4/11/2023 5:20 PM, Jim Porter wrote: > If we did something like this, I think both post-commit and pre-push > hooks would be useful. The former gives committers immediate feedback on > their commit message (if they read the output), while the latter is what > ensures that the upstream commit messages are properly-formatted. Attached is a mostly-working pair of hooks (post-commit and pre-push) to check this. There's still a bit more work to do though: 1. Clean up the output a bit 2. Make it work on non-gawk awks Both of those should be pretty easy though. Here's an example of the error if you try to push: -------------------------------------------------- In commit 89f2dbb773: My commit message File lisp/bad.el listed in commit message, but not in diff Push aborted; please see the file 'CONTRIBUTE' error: failed to push some refs to 'jporter@git.sv.gnu.org:/srv/git/emacs.git' -------------------------------------------------- For the post-commit hook, we just pass the current commit SHA to our awk script, which checks that SHA to make sure its commit message is correct. For the pre-push hook, we need to compare the local ref that we're pushing to the remote ref, and then check every commit between the two (the Git documentation explains a bit about how the hook works[1]). Assuming the general strategy looks ok, I'll finish this up and add more documentation for what's going on. [1] https://git-scm.com/docs/githooks#_pre_push