Making WordPress.org

Opened 6 months ago

Closed 6 months ago

#7784 closed enhancement (reported-upstream)

Add Precommit Hook to WordPress Core SVN

Reported by: jorbin's profile jorbin 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.


6 months ago

#2 @Otto42
6 months ago

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.

#3 @dd32
6 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.

#4 @dd32
6 months ago

  • Keywords pending-systems added
  • Resolution set to reported-upstream
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.