svn 要求commit提交必須加註釋(日誌) hook

snale1989發表於2016-12-23

#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

完成

相關文章