javascript - Why would my SVN pre-commit hook work locally, but not on commit? -


i have following pre-commit hook use javascript lint checking javascript files before committing:

#!/bin/env bash  repos="$1" txn="$2"  echo=/bin/echo grep=/bin/grep sed=/bin/sed  svn=/usr/bin/svn svnlook=/usr/bin/svnlook files_changed=`$svnlook changed -r$txn $repos | $sed -e "s/^....//g"`  jsl=/usr/local/bin/jsl jsl_conf=/usr/local/etc/jsl.conf  file in $files_changed         if $echo $file | $grep "\.js$"                         $svn cat -r$txn file://$repos/$file | $jsl -conf $jsl_conf -stdin 1>&2                 jsl_error_code=$?                 if [ $jsl_error_code != 0 ]                                         exit $jsl_error_code                 fi         fi done  # if got here, nothing wrong. exit 0 

this code works locally follows: ./pre-commit /my/svn/repo/location 6781 # number transaction number

but doesn't error correctly on svn commit.

i have accounted for:

  • there being no $path, explicitly set command paths.
  • i catching correct error code jsl command exit.
  • i pushing stdout stderr jsl command displayed in commit fail.

what missing?

yours,
trevor

it possible 1 of programs you're running expect environment variables set.

from repository creation , configuration:

for security reasons, subversion repository executes hook scripts empty environment—that is, no environment variables set @ all, not $path or %path%. because of this, lot of administrators baffled when hook script runs fine hand, doesn't work when run subversion. sure explicitly set environment variables in hook and/or use absolute paths programs.

try execute them locally without environment variables set , see if works.

i end importing environment in first line of hook scripts:

source /home/username/.bash_profile 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -