Opened 14 months ago
Closed 14 months ago
#7784 closed enhancement (reported-upstream)
Add Precommit Hook to WordPress Core SVN
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Component: | Version Control | Keywords: | pending-systems |
| Cc: |
Description
I think we would benefit from a pre-commit hook which checks to make sure that commit messages are not empty.
I think we could do something like (untested):
#!/bin/sh
REPO="$1"
MSG="$2"
SVNLOOK=/usr/bin/svnlook
MINSIZE=10
MSGSIZE=${#MSG}
OK=1;
$SVNLOOK log -t "$REPO" "MSG" | grep "[a-zA-Z0-9]" > /dev/null || OK=0
if [ $SVNLOOKOK -eq 0 || "$MSGSIZE" -le "$MINSIZE" ]; then
echo "Empty commit messages are not allowed. Please provide a proper message." 1>&2
exit 1
fi
exit 0
Example of an empty commit: https://core.trac.wordpress.org/changeset/59087
Change History (4)
This ticket was mentioned in Slack in #core-committers by jorbin. View the logs.
14 months ago
#3
@
14 months ago
We do have a pre-commit hook on themes & plugins requiring a minimum of 5 character commit messages.
Adding one to core of a minimum of 5 characters to avoid mistakes like this would be reasonable, I don't think it's needed to require more than 5 here though as even if we were to require 5 words or 50 characters they've still got commit guides to follow.
I'll post a systems request.
We already have such a hook on plugins.svn, I don't know why it's not on core and everything else as well. So, +1.
However, core is a limited set of committers, so speaking to the committers about that directly is probably a better plan in the long run than enforcing it via code.