Skip to content

Instantly share code, notes, and snippets.

@acosonic
Last active October 18, 2017 13:03
Show Gist options
  • Save acosonic/f3cb240756912216655ed2d35e5298fb to your computer and use it in GitHub Desktop.
Save acosonic/f3cb240756912216655ed2d35e5298fb to your computer and use it in GitHub Desktop.
Svn pre-commit hook requiring Redmine's issue id to be referenced with # as described in Redmine Cookbook a book by Packt Publishing
#!/bin/sh
# This script requires you to have svnlook installed (update it's location on line 5, if required...)
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep -e "refs #" -e "production" | wc -c)
if [ "$LOGMSG" -le 0 ]; then echo "Valid comments needs to have refs #issueID." 1>&2
exit 1
fi
# Exit on all errors.
set -e
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment