1.进入仓库project1/hooks目录,找到pre-commit.tmpl文件
cp pre-commit.tmpl pre-commit
2.编辑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
这三行注释掉(前面加#符号),
3.在此位置添加如下几行:
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 5 ];#要求注释不能少于5个字符,您可自定义
then
echo -e "\nLog message cann't be empty! you must input more than 5 chars as comment!." 1>&2
exit 1
fi
保存,退出。
4.给pre-commit添加可执行权限:
chmod 755 pre-commit