ubuntu svn post commit hook does not work, but works on manual running

978 views Asked by At
/usr/bin/svn update /var/project2_test/debug --username XXXX--password XXXX
/bin/echo $REV >> /var/project2_test/svn.log

the log has been updated while committing. but working copy never update. And I run /home/admin/svn/project/hooks/post-commit by hand. IT WORKS!

1

There are 1 answers

2
Lazy Badger On
  1. Post-commit hook (any hook really)
    • running in empty environment
    • running under another user credentials, than on running by hand (user of SVN-server used)
  2. Anyway, you have to debug hook's script under real conditions (as hook). In orderto do it, you have
    • Intercept output of update command (by redirecting stdout to stderr)
    • Show this output to user, which perform commit, i.e, because stderr marshalled to user only in case of error in hook, you have to exit hook with non-zero exit-code

Hook in debug-stage will be something like

/usr/bin/svn update /var/project2_test/debug --username XXXX --password XXXX > &2
/bin/echo $REV >> /var/project2_test/svn.log
exit 1