Unable to generate output from svn pre-commit hook

I have a centos6 linux server that hosts the svn repository (version 1.6.11 (r934486)), accessible via DAV via Apache. To access the repo, I use the windows tortoise-svn 1.7.12 client.

I have an extremely simple test capture that will always fail.

echo "this is a test" exit 1 

Attempts to fail using

 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 expected to see β€œthis is a test” on my client, but I get a pre-commit hook that exits without output. hooks / pre-commit is executable and dispatches the expected result when manually launched on the linux server.

Any pointers to what I am missing?

+4
source share
1 answer

Only the output printed on stderr is passed to the client. Thus, the following change should make your test hook work:

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

For reference, here is the corresponding quote from the Subversion Book :

"If the hook pre-commit program returns a nonzero exit value, commit is aborted, the commit transaction is deleted, and anything printed on stderr is sent back to the client."

+6
source

Source: https://habr.com/ru/post/1482737/


All Articles