Question

I have a centos6 linux server hosting a svn (version 1.6.11 (r934486)) repo, accessible over DAV via Apache. I am using the windows tortoise-svn client 1.7.12 to access the repo.

I have an extremely simple test pre-commit hook that will always fail.

echo "this is a test"
exit 1

Attempts at committing fail with

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

I was expecting to see "this is a test" on my client but I getting pre-commit hook exited with no output. hooks/pre-commit is executable and echoes the expected output when run by hand on the linux server.

Any pointers on what I am missing?

Was it helpful?

Solution

Only output printed to stderr is relayed to the client. So the following change should make your test hook work:

echo "this is a test" >&2
exit 1

For reference, here's the relevant quote from the 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."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top