通过定制 pre-commit 禁止提交空注释的代码 ::-- ZoomQuiet [2007-08-04 14:50:43]
Contents
# PRE-COMMIT HOOK
#
# The pre-commit hook is invoked before a Subversion txn is
# committed. Subversion runs this hook by invoking a program
# (script, executable, binary, etc.) named 'pre-commit' (for which
# this file is a template), with the following ordered arguments:
#
# [1] REPOS-PATH (the path to this repository)
# [2] TXN-NAME (the name of the txn about to be committed)
#
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/local/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null
if [ $? != 0 ]; then
echo "$TXN $REPOS" 1>&2
echo "Alert! Commit message can not be empty." 1>&2
exit 1
fi
exit 0
