Вопрос

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top