[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: pre-commit hooks work at first, but then stop

From: Adrian Hoe <mailbox_at_adrianhoe.com>
Date: 2005-07-29 05:29:55 CEST

On Jul 29, 2005, at 4:22 AM, Gregory MacDonald wrote:

> I'm having an odd error with my pre-commit hook. It works fine for
> about 5 or 6 commit attempts (blocking and letting through what I
> want), but then stops working entirely. After which the client (GUI
> or commandline) just hangs forever. Here's a copy of my hook. I've
> tried running svnserve as root with no luck. I've checked
> permissions as well. Thanks in advance.
>
> -Greg MacDonald
>
> #!/bin/sh
>
> REPOS="$1"
> TXN="$2"
>
> # Make sure that the log message contains some text.
> SVNLOOK=/usr/bin/svnlook
>
> if ! $SVNLOOK log -t "$TXN" "$REPOS" | /bin/grep "[a-zA-Z0-9]"
> then
> echo "Please_enter_a_comment." 1>&2
> exit 1
> fi
>
> if $SVNLOOK changed -t "$TXN" "$REPOS" | /bin/grep -Eo "^A .*/[\._]
> [^/]+$"
> then
> echo "Please_do_not_commit_configuration_files." 1>&2
> exit 1
> fi
>
> if $SVNLOOK changed -t "$TXN" "$REPOS" | /bin/grep -Eo "^A .*temp$"
> then
> echo "Please_do_not_commit_temp_files." 1>&2
> exit 1
> fi
>
> if $SVNLOOK changed -t "$TXN" "$REPOS" | /bin/grep -Eo "^A .*tmp$"
> then
> echo "Please_do_not_commit_tmp_files." 1>&2
> exit 1
> fi
>
> if $SVNLOOK changed -t "$TXN" "$REPOS" | /bin/grep -Eo "^A .*/[^/]*
> [A-Z]+[^/]*$"
> then
> echo "Please_do_not_use_capitals." 1>&2
> exit 1
> fi
>
> # All checks passed, so allow the commit.
> exit 0

I am not good at shell script. But don't you need to redirect output
to /dev/null?

Like this:

$SVNLOOK log -t "$TXN" "$REPOS" | \
    grep "[a-zA-Z0-9]" > /dev/null || exit 1

--
"If you missed the rising sun and the morning dew, don't miss the  
beautiful sunset." -- Adrian Hoe inspired by Michal Nowak, June 15 2004
http://adrianhoe.com
Received on Fri Jul 29 05:31:49 2005

This is an archived mail posted to the Subversion Users mailing list.