Force comments in commits – Subversion (SVN)

You need to set this up on the server which hosts the SVN repository. Enter the repository and you should see a folder labelled hooks, create a new file labelled pre-commit without any extension and paste the following code inside

 

#!/bin/sh

REPOS="$1"
TXN="$2"

SVNLOOK=/usr/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
   grep "[a-zA-Z0-9]" > /dev/null

GREP_STATUS=$?
if [ $GREP_STATUS -ne 0 ]
then
    echo "Your commit has been blocked because you didn't give any log message" 1>&2
    echo "Please write a log message describing the purpose of your changes and" 1>&2
    echo "then try committing again. -- Thank you" 1>&2
    exit 1
fi
exit 0

 

Note: I did not come up with this solution, I will update the source as soon as I can find it again.