Hello all,

My company has implemented a commit control system, but it is
currently applied by a call from loginfo, which means that the best
we can do is sound an alarm if a commit we don't like goes through.
We need it at loginfo so that we can take into account the log
message, the branch, and the operation on each file involved.  

In order to make this system more effective, and eliminate some
internal spamming, I've hacked cvs-1.11.1p1 so that the log message
is obtained *before* commit, the loginfo filter handler
(logfile_write()) returns the status of the pipe when it closes, and
commitinfo's lines are processed by logfile_write().  

What I'd like to know is whether this is a horrible idea (I realize
it breaks compatibility with current commitinfo behavior, but we've
decided not to care).  More importantly, because I'm reasonably sure
this is what we want to do, I'd like to know if my implementation
(read: "hack")-- attached-- seems likely in anyone's mind to have 
unintended consequences.  I'll be testing it here, of course, but I 
have limited experience with CVS.  Any comments would be greatly
appreciated.


-- 
   Logan Johnson     :: [EMAIL PROTECTED]
   Terraspring, Inc. :: http://www.terraspring.com
diff -ru cvs-1.11.1p1.orig/src/commit.c cvs-1.11.1p1/src/commit.c
--- cvs-1.11.1p1.orig/src/commit.c	Tue Apr 24 11:14:53 2001
+++ cvs-1.11.1p1/src/commit.c	Thu Dec  6 13:20:04 2001
@@ -1131,10 +1131,13 @@
 	free (s);
     }
 
+   return logfile_write (repository, filter, saved_message, (FILE*) 0, saved_ulist);
+/*
     run_setup (filter);
     run_arg (repository);
     (void) walklist (saved_ulist, precommit_list_proc, NULL);
     return (run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL|RUN_REALLY));
+*/
 }
 
 /*
@@ -1163,6 +1166,12 @@
     if (saved_ulist == NULL || saved_ulist->list->next == saved_ulist->list)
 	return (err);
 
+    /* get commit message */
+    got_message = 1;
+    if (use_editor)
+	 do_editor (update_dir, &saved_message, repos, saved_ulist);
+    do_verify (saved_message, repos);
+ 
     /* run any pre-commit checks */
     if ((n = Parse_Info (CVSROOTADM_COMMITINFO, repos, precommit_proc, 1)) > 0)
     {
diff -ru cvs-1.11.1p1.orig/src/logmsg.c cvs-1.11.1p1/src/logmsg.c
--- cvs-1.11.1p1.orig/src/logmsg.c	Tue Apr 24 11:14:53 2001
+++ cvs-1.11.1p1/src/logmsg.c	Thu Dec  6 11:38:37 2001
@@ -11,7 +11,7 @@
 
 static int find_type PROTO((Node * p, void *closure));
 static int fmt_proc PROTO((Node * p, void *closure));
-static int logfile_write PROTO((char *repository, char *filter,
+int logfile_write PROTO((char *repository, char *filter,
 			  char *message, FILE * logfp, List * changes));
 static int rcsinfo_proc PROTO((char *repository, char *template));
 static int title_proc PROTO((Node * p, void *closure));
@@ -629,7 +629,7 @@
  * Writes some stuff to the logfile "filter" and returns the status of the
  * filter program.
  */
-static int
+int
 logfile_write (repository, filter, message, logfp, changes)
     char *repository;
     char *filter;
@@ -841,7 +841,8 @@
     }
     free (prog);
     pipestatus = pclose (pipefp);
-    return ((pipestatus == -1) || (pipestatus == 127)) ? 1 : 0;
+    return ( pipestatus );
+    /* return ((pipestatus == -1) || (pipestatus == 127)) ? 1 : 0; */
 }
 
 /*

Reply via email to