Skip to content

Instantly share code, notes, and snippets.

@derektamsen
Last active September 4, 2016 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derektamsen/7e7c24e0ea18f26a3ab8737f767b0b9d to your computer and use it in GitHub Desktop.
Save derektamsen/7e7c24e0ea18f26a3ab8737f767b0b9d to your computer and use it in GitHub Desktop.
Deny commits to tags in a subversion repository via pre-commit hook. http://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.pre-commit.html
#!/bin/sh
# Save in `hooks/pre-commit` and `chmod +x hooks/pre-commit`
# source: http://stackoverflow.com/a/576261
#
# Denies commits to tags with a pre-commit hook
REPOS="${1}"
TXN="${2}"
SVNLOOK='/usr/bin/svnlook'
# Committing to tags is not allowed
$SVNLOOK changed -t "${TXN}" "${REPOS}" | grep '^U\W*tags' && /bin/echo 'Cannot commit to tags!' 1>&2 && exit 1
# 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