打开hooks,然后将pre-commit.tmpl修改为pre-commit,打开pre-commit,写入如下代码:
[root@node1 hooks]# cat pre-commit
#!/bin/sh
REPOS=”$1″
TXN=”$2″
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
#$SVNLOOK log -t “$TXN” “$REPOS” | \
# grep “[a-zA-Z0-9]” > /dev/null || exit 1
# Check that the author of this commit has the rights to perform
# the commit on the files and directories being modified.
#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 10 ];
then
echo “Log message can’t be empty! you must input more than 10 chars as comment!.” 1>&2
exit 1
fi
# All checks passed, so allow the commit.
#exit 0
将pre-commit设置为可执行
[root@node1 hooks]# chmod +x pre-commit
操作完以上操作后测试不写注释提交是否会提示如下报错: