[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mistakes in commit log messages
From: |
Jim Porter |
Subject: |
Re: Mistakes in commit log messages |
Date: |
Wed, 12 Apr 2023 23:18:37 -0700 |
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
0001-WIP-Add-Git-hooks-to-check-filenames-listed-in-the-c.patch
Description: Text document
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Alan Mackenzie, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/11
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/11
- Re: Mistakes in commit log messages,
Jim Porter <=
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/13
- Re: Mistakes in commit log messages, Robert Pluim, 2023/04/13
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/14
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/15
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/15
- Re: Mistakes in commit log messages, Alan Mackenzie, 2023/04/15
- Re: Mistakes in commit log messages, Eli Zaretskii, 2023/04/15
- Re: Mistakes in commit log messages, Filipp Gunbin, 2023/04/21
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/15
- Re: Mistakes in commit log messages, Jim Porter, 2023/04/15