网上找到的都是这个作法,可是我按着这个步骤改了以后根本无论用,不写注释仍是照样能提交:
进入仓库project/hooks目录,找到pre-commit.tmpl文件,重命名为pre-commit。
编辑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
这三行注释掉(前面加#符号),
在此位置添加以下几行:
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
保存,退出。
给pre-commit添加可执行权限:
chmod +x pre-commitnode
原文:http://glitterlife.info/node/16input