问题
/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:
- 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)
- 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
- Intercept output of
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
来源:https://stackoverflow.com/questions/18484972/ubuntu-svn-post-commit-hook-does-not-work-but-works-on-manual-running