[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reject cvs commits with empty log messages
From: |
Mark D. Baushke |
Subject: |
Re: Reject cvs commits with empty log messages |
Date: |
Wed, 02 Jun 2004 01:29:29 -0700 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ivan Ivanov <address@hidden> writes:
> Dear colleagues,
>
> I am fairly new to cvs administration, although I use
> cvs constantly. I would like to know how I can
> configure my cvs server so that it rejects commits
> that have empty log messages, i.e. when one tries
> cvs commit -m "" myfile.txt
> myfile.txt won't be committed in the repository.
>
> I checked the Cederqvist and that this can be done
> with
> verifymesg and rcsinfo files. I also tried the sample
> given there but didn't get them to work.
> According to the manual "Each line in the `verifymsg'
> file consists of a regular expression and a
> command-line template. The template must include a
> program name, and can include any number of arguments.
> The full path to the current log message template file
> is appended to the template."
>
> So my quiestions are
> 1) What regular expression should stay in my verifymsg
> file
Whatever you want.
> 2) How should I make the check for an empty log
> message? I know it could done in a .sh file for
> example.
Here is a trivial example. It just checks that the log
message file that is passed to the script given in the
verifymsg file has a non-zero length:
------- zero length log messages fail the test -------
#! /bin/sh
# Exit 0 (no error) if the log message is not empty
[ ! -s $1 ] && exit 0 || exit 1
------- zero length log messages fail the test -------
Of course, a log message of "-m ' '" would still be allowed
in this case, so you might want to use something like:
------- zero word log messages fail the test -------
#! /bin/sh
# A log message must have more than zero words to be allowed.
a=`wc -w $1`
expr "$a" : "^ *0 $1" > /dev/null || exit 0 && exit 1
------- zero word log messages fail the test -------
> 3) Where should I place this .sh file in my
> filesystem?
Wherever you wish. Many folks have been know to use something like
DEFAULT $CVSROOT/CVSROOT/logcheck
and add 'logcheck' to the CVSROOT/checkoutlist file and put
logcheck into the CVSROOT directory.
> Thank you very much in advance
> Ivan Ivanov
Enjoy!
-- Mark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)
iD8DBQFAvY/p3x41pRYZE/gRAi8wAJ92PF7MBuIjML/l6AORR18O1+he2QCeMkHW
PpM6HEybKbsyJG4KwPK2crA=
=q3TJ
-----END PGP SIGNATURE-----