首页 > 技术文章 > svn 要求commit提交必须加注释(日志) hook

chenjiahe 2016-12-23 16:27 原文

#vim /data/svn/mysvn/hook/pre-commit

#!/bin/bash
REPOS="$1"
TXN="$2"
#RES="OK"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS"|grep "[a-zA-Z0-9]" |wc -c`
if [ "$LOGMSG" -lt 11 ];then
echo -e "Please input at least 10 character" 1>&2
exit 1
fi
#$SVNLOOK log -t "$TXN" "$REPOS" \
#| egrep "[^[:space:]]+" >/dev/null || unset RES
#if [ "$RES" != "OK" ] ; then
# echo "You must input some comments for you commit" 1>&2
# exit 1
#fi
# All checks passed, so allow the commit.
exit 0

 

 

添加完脚本 chmod +x  /data/svn/mysvn/hook/pre-commit

完成

推荐阅读