linux - Pre-commit hook for Subversion fails -


i need basic hook prevent empty comment checkins. googled, found sample bash script. made short , here have:

#!/bin/sh  repos="$1" txn="$2"  # make sure log message contains text. svnlook=/usr/bin/svnlook iconv=/usr/bin/iconv  svnlookok=1 $svnlook log -t "$txn" "$repos" | \ grep "[a-za-z0-9]" > /dev/null || svnlookok=0 if [ $svnlookok = 0 ];   echo "empty log messages not allowed. please provide proper log message." >&2   exit 1 fi  # comments should have more 5 characters logmsg=$($svnlook log -t "$txn" "$repos" | grep [a-za-z0-9] | wc -c)  if [ "$logmsg" -lt 6 ];   echo -e "please provide meaningful comment when committing changes." 1>&2   exit 1 fi 

now i'm testing tortoise svn , here see:

commit failed (details follow): commit blocked pre-commit hook (exit code 1) output: /home/svn/repos/apress/hooks/pre-commit: line 11: : command not found empty log messages not allowed. please provide proper log message. error generated custom hook script on subversion server. please contact server administrator resolving issue.

what error? svnlook in /usr/bin i'm new linux, don't understand happens..

to debug script you'll have run manually. you'll have sample values parameters passed it. change beginning of script like

#!/bin/sh  repos="$1" txn="$2"  echo "repos = $repos, txn = $txn" >/tmp/svnhookparams.txt 

do commit , check file /tmp/svnhookparams.txt values.

then change script:

#!/bin/sh  set -x  repos="$1" txn="$2" 

this enable echo of commands run shell.

now run script directly terminal passing values got previously.

check output invalid commands or empty variable assignments. if have problems that, post output here.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -