简体   繁体   中英

Apache Subversion pre-commit hook fails

I am trying to configure a pre-commit hook for Appache subversion, which will enforce checkstyle on the java files. I am new to SVN configuration and hooks so I am using a tested on another server hook, which is working on that other server.

However when I configured it on a fresh installation and when try to commit (create new folder) I get the following error:

 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

Here's the hook around line 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
    }

Try changing the #! line at the top of the script to invoke the shell as bash rather than sh - hyphens in function names are not allowed in strict POSIX mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM