linux强制svn提交时必须写注释

时间:2022-12-14 17:52:44

打开hooks,然后将pre-commit.tmpl修改为pre-commit,打开pre-commit,写入如下代码:

 #!/bin/sh
REPOS="$1"
TXN="$2" SVNLOOK=/usr/bin/svnlook #根据你的SVN目录而定 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

保存!

将pre-commit设置为可执行

chmod +x pre-commit

搞定!!