Created
September 25, 2014 12:20
-
-
Save TobiX/a2785a9af5a30ad23b00 to your computer and use it in GitHub Desktop.
SVN commit hook that denies changing of tags.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
REPOS="$1" | |
TXN="$2" | |
SVNLOOK=/usr/bin/svnlook | |
# Make sure that the log message contains some text. | |
if ! $SVNLOOK log -t "$TXN" "$REPOS" | \ | |
grep "[a-zA-Z0-9]" > /dev/null | |
then | |
echo "Bitte eine Commit-Meldung angeben!" >&2 | |
exit 1 | |
fi | |
# Deny transaction if any line writes to tags directory that exists. | |
CHANGED_TAG=`$SVNLOOK dirs-changed -t "$TXN" "$REPOS" 2>/dev/null | \ | |
sed -n "/^tags\/./ { s|^tags/||; s|/.*$||; p; q; }"` | |
if [ "$CHANGED_TAG" ] | |
then | |
echo "Bereits existiterendes Tag ${CHANGED_TAG} kann nicht geaendert werden!" >&2 | |
exit 1 | |
fi | |
# All checks passed, so allow the commit. | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment