我有一个托管 svn(版本 1.6.11 (r934486))存储库的 centos6 linux 服务器,可通过 Apache 通过 DAV 访问。我正在使用 windows tortoise-svn 客户端 1.7.12 来访问 repo。
我有一个非常简单的测试预提交钩子(Hook),它总是会失败。
echo "this is a test"
exit 1
尝试提交失败
Sending content: D:\code\foo\test.c
Error: Commit failed (details follow):
Error: Commit blocked by pre-commit hook (exit code 1) with no output.
Completed!:
我期待在我的客户端上看到“这是一个测试”,但是我得到了 pre-commit 钩子(Hook)退出而没有输出。 hooks/pre-commit 是可执行的,并且在 linux 服务器上手动运行时会回显预期的输出。
关于我缺少什么的任何指示?
最佳答案
只有打印到 stderr 的输出才会中继到客户端。因此,以下更改应该使您的测试 Hook 工作:
echo "this is a test" >&2
exit 1
作为引用,这里是来自 Subversion book 的相关报价。 :
"If the
pre-commit
hook program returns a nonzero exit value, the commit is aborted, the commit transaction is removed, and anything printed to stderr is marshalled back to the client."
关于svn - 无法从 svn 预提交 Hook 生成输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16751653/