1. 重命名svn主目录中hooks的pre-commit.tmpl文件为pre-commit,并添加可执行权限
mv pre-commit.tmpl pre-commit
chmod u+x pre-commit
2. 编辑pre-commit文件
vi pre-commit # 注释这以下三行 # $SVNLOOK log -t "$TXN" "$REPOS" | # grep "[a-zA-Z0-9]" > /dev/null || exit 1
# commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1 # 在“# commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1”后添加
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c` if [ "$LOGMSG" -lt 8 ] then echo -e " Log message cann't be empty! you must input more than 8 chars as comment!" 1>&2 exit 1 fi
注:一个汉字对应16个字符