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

爱⌒轻易说出口 提交于 2019-12-13 03:59:05

问题


/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:


  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


来源:https://stackoverflow.com/questions/18484972/ubuntu-svn-post-commit-hook-does-not-work-but-works-on-manual-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!