我正在尝试为 Appache 颠覆配置一个预提交钩子,它将对 java 文件强制执行 checkstyle。我是 SVN 配置和钩子的新手,所以我正在使用在另一个服务器上测试过的钩子,该钩子正在另一台服务器上工作。
但是,当我在全新安装上配置它并尝试提交(创建新文件夹)时,我收到以下错误:
A repository hook failed
svn: Commit blocked by pre-commit hook (exit code 2) with output:
/var/www/svn/mse/hooks/pre-commit: line 23: `permit-tag-write': not a valid identifier
这是第 22 行的钩子:
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
JAVA=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64
PROJECT_NAME=mse
permit-tag-write()
{
if $SVNLOOK changed -t "$TXN" "$REPOS" | awk '{print $2}' |\
grep -q "^tags" ; then
/bin/echo "Cannot commit to tags" 1>&2
exit 1
fi
}