#!/bin/sh # # pre-commit svn hook that makes sure every commit contains a message that # matches a specific pattern. # SVNLOOK=/usr/bin/svnlook REPOS="$1" TXN="$2" # Check that the log contains a ticket reference $SVNLOOK log -t "$TXN" "$REPOS" | grep "^[a-zA-Z].* (refs #[1-9][0-9]*)$" > /dev/null if [ $? -ne 0 ] ; then echo "" > /dev/stderr echo "Mateusz is not liking your commit description. Sorry!" > /dev/stderr echo "The expected format is this:" > /dev/stderr echo "" > /dev/stderr echo " \"some description (refs #1234)\"" > /dev/stderr echo "" > /dev/stderr echo "where 'some description' is a meaningfull english description of what you" > /dev/stderr echo "did, and #1234 is the ticket reference that this commit relates to." > /dev/stderr echo "You are advised to fix your description message and try again. Good luck!" > /dev/stderr exit 1 fi exit 0