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

Re: How to prevent empty log messages?

From: Ryan Schmidt <subversion-2008b_at_ryandesign.com>
Date: Tue, 24 Jun 2008 15:36:40 -0500

On Jun 24, 2008, at 09:52, Matthew Pounsett wrote:

> On 16-Jun-2008, at 12:08 , Andy Levy wrote:
>
>> The default pre-commit hook script template (pre-commit.tmpl in your
>> repository's hooks directory) demonstrates exactly this. There are
>> also numerous examples findable via Google and the SVN Users list
>> archives.
>
> A bit late to the thread, I realize. :)
>
> The default pre-commit hook is useful, but I'd like to offer up
> this modification of it, which will provide commandline clients
> with a useful error message:
>
> # Make sure that the log message contains some text.
> SVNLOOK=/usr/local/bin/svnlook
> TEXT=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]"`
>
> if [ "x${TEXT}" = "x" ]; then
> echo "Empty commit message." 1>&2
> exit 1;
> fi

I agree it would be nice to include a better example of best practice
in the pre-commit.tmpl. Surely returning a message to the user
explaining *why* a commit failed is a best practice.

But why do we still need this "x" trick? Surely bash can properly
detect empty strings by now.

if [ -z "${TEXT}" ]; then
     ...
fi

> I haven't (yet) tested this with tortoise or any other GUI client,
> so I'm not sure how they'll behave with the returned error
> message. This might be useful to some people though.

Ought to work fine in any client.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-06-24 22:37:09 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.