Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to throw a warning in a pre-commit hook but without aborting the commit. However, it seems svn bufferizes the output and only displays it if the check aborts.

Is it possible to output warnings without aborting?

share|improve this question
up vote 3 down vote accepted

Warnings can actually be achieved in post-commit hooks by making them fail (with $? != 0, just as with pre-commit hooks).

So in my case, I made the command I'm using return 1 for errors and 2 for warnings, and I call it in both pre- and post-commit hooks.

In the pre-commit hook, I have:

/usr/bin/augeas-validator $(svnlook changed -t "$TXN" "$REPOS" | awk '/^[^D].*$/ {print $2}')
if [ $? = 1 ]; then
   exit 1

while in the post-commit hook, I have:

/usr/bin/augeas-validator $(svnlook changed -r "$REV" "$REPOS" | awk '/^[^D].*$/ {print $2}') || exit 1

Thus, errors prevent the commit while warnings only make the post-commit hook error out, which doesn't prevent the commit but still warns the user with the content of STDERR.

share|improve this answer

You could send the warnings via email using the mail command.

share|improve this answer
Right, I'm aware of that, but I don't want to. If users get read an email about a file they've committed 15 minutes ago, they're unlikely to go fix it. If they get a message in the console, they might fix it. – ℝaphink Sep 12 '11 at 15:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.