[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix for detecting empty commit log message
From: |
Mark Valentine |
Subject: |
fix for detecting empty commit log message |
Date: |
Sat, 16 Jun 2001 03:58:35 +0100 (BST) |
CVS attempts to detect an empty or unchanged log message from a commit
log editing session, but misses a case where someone tries to abort a
commit by deleting all but the CVS: lines before quitting the editor
(it does detect the case where the leading blank line inserted by older
versions is left in).
The patch below detects this case, which I know has caught many people
out over the years, but I'd always put down to the effects of a very simple
detection algorithm rather than a bug (until I finally looked at the code
just now, trying to be more clever than I'd had it down for).
My (simple) testing was actually done using a similar patch against the
version of CVS in the current FreeBSD CVS repository - I don't have the
latest CVS code checked out in its entirety here.
Cheers,
Mark.
Index: logmsg.c
===================================================================
RCS file: /cvsroot/ccvs/src/logmsg.c,v
retrieving revision 1.51
diff -u -r1.51 logmsg.c
--- logmsg.c 16 Apr 2001 17:49:32 -0000 1.51
+++ logmsg.c 16 Jun 2001 02:36:59 -0000
@@ -337,7 +337,7 @@
error (0, errno, "warning: cannot close %s", fname);
if (pre_stbuf.st_mtime == post_stbuf.st_mtime ||
- *messagep == NULL ||
+ *messagep == NULL || (*messagep)[0] == '\0' ||
strcmp (*messagep, "\n") == 0)
{
for (;;)
--
Mark Valentine, Thuvia Labs <mark@thuvia.co.uk> <http://www.thuvia.co.uk>
"Tigers will do ANYTHING for a tuna fish sandwich." Mark Valentine uses
"We're kind of stupid that way." *munch* *munch* and endorses FreeBSD
-- <http://www.calvinandhobbes.com> <http://www.freebsd.org>
- fix for detecting empty commit log message,
Mark Valentine <=