Index: doc/cvs.texinfo =================================================================== RCS file: /arch/cvs/home/ccvs/doc/cvs.texinfo,v retrieving revision 1.2.2.3 diff -u -r1.2.2.3 cvs.texinfo --- doc/cvs.texinfo 9 Oct 2005 14:26:48 -0000 1.2.2.3 +++ doc/cvs.texinfo 4 Jun 2007 05:40:31 -0000 @@ -13509,6 +13509,8 @@ @file{commitinfo} supports: @table @t +@item m +the log message (escaped) @item @{s@} a list of the names of files to be committed @end table Index: src/commit.c =================================================================== RCS file: /arch/cvs/home/ccvs/src/commit.c,v retrieving revision 1.2.2.3 diff -u -r1.2.2.3 commit.c --- src/commit.c 9 Oct 2005 14:27:24 -0000 1.2.2.3 +++ src/commit.c 4 Jun 2007 05:40:31 -0000 @@ -1225,6 +1225,10 @@ char *cmdline; const char *srepos = Short_Repository (repository); List *ulist = closure; + char *log_message_escaped; + + log_message_escaped = xmalloc(strlen(saved_message)*2+1); + shell_escape(log_message_escaped, saved_message); #ifdef SUPPORT_OLD_INFO_FMT_STRINGS if (!strchr (filter, '%')) @@ -1254,6 +1258,7 @@ "R", "s", referrer ? referrer->original : "NONE", #endif /* SERVER_SUPPORT */ "p", "s", srepos, + "m", "s", log_message_escaped, "r", "s", current_parsed_root->directory, "s", ",", ulist, precommit_list_to_args_proc, (void *) NULL, @@ -1264,12 +1269,14 @@ if (!cmdline || !strlen (cmdline)) { if (cmdline) free (cmdline); + free (log_message_escaped); error (0, 0, "precommit proc resolved to the empty string!"); return 1; } run_setup (cmdline); free (cmdline); + free (log_message_escaped); return run_exec (RUN_TTY, RUN_TTY, RUN_TTY, RUN_NORMAL | RUN_REALLY); } Index: src/mkmodules.c =================================================================== RCS file: /arch/cvs/home/ccvs/src/mkmodules.c,v retrieving revision 1.2.2.3 diff -u -r1.2.2.3 mkmodules.c --- src/mkmodules.c 9 Oct 2005 14:27:24 -0000 1.2.2.3 +++ src/mkmodules.c 4 Jun 2007 05:40:31 -0000 @@ -168,6 +168,7 @@ #endif "# %p = path relative to repository\n", "# %r = repository (path portion of $CVSROOT)\n", + "# %m = log message (escaped)\n", "# %{s} = file name, file name, ...\n", "#\n", "# If no format strings are present in the filter string, a default of\n", Index: src/run.c =================================================================== RCS file: /arch/cvs/home/ccvs/src/run.c,v retrieving revision 1.2.2.2 diff -u -r1.2.2.2 run.c --- src/run.c 9 Oct 2005 14:27:24 -0000 1.2.2.2 +++ src/run.c 4 Jun 2007 05:40:31 -0000 @@ -83,8 +83,12 @@ break; case '"': case '\'': + /* matching quotes ? close it */ if (inquotes == *d) inquotes = '\0'; - else inquotes = *d; + /* no matching quotes - open quotes */ + else if (!inquotes) inquotes = *d; + /* we have quotes of different type - pass unchanged */ + else d++; break; case ' ': case '\t': Index: src/sanity.sh =================================================================== RCS file: /arch/cvs/home/ccvs/src/sanity.sh,v retrieving revision 1.2.2.3 diff -u -r1.2.2.3 sanity.sh --- src/sanity.sh 9 Oct 2005 14:27:24 -0000 1.2.2.3 +++ src/sanity.sh 4 Jun 2007 05:40:31 -0000 @@ -1682,6 +1682,8 @@ tests="${tests} dottedroot fork commit-d template" tests="${tests} writeproxy writeproxy-noredirect writeproxy-ssh" tests="${tests} writeproxy-ssh-noredirect" + tests="${tests} precommitlog" + else tests="$*" fi @@ -35508,6 +35510,62 @@ + precommitlog) + # make sure the %m option for commitinfo works + rm -rf $CVSROOT_DIRNAME/CVSROOT + dotest precommitlog-0 "${testcvs} -d $CVSROOT_DIRNAME init" + mkdir 1; cd 1 + dotest precommitlog-1 "${testcvs} -Q co ." '' + mkdir mydir + dotest precommitlog-2 "${testcvs} add mydir" \ +"Directory ${CVSROOT_DIRNAME}/mydir added to the repository" + cd mydir + echo 'file1' > file1 + dotest precommitlog-3 "${testcvs} add file1" \ +"${SPROG} [a-z]*: scheduling file .file1. for addition +${SPROG} [a-z]*: use .${SPROG} commit. to add this file permanently" + dotest precommitlog-4 "${testcvs} -q ci -m add file1" \ +"${CVSROOT_DIRNAME}/mydir/file1,v <-- file1 +initial revision: 1\.1" + + # now change commitinfo to use the %m - send log message to filter + cd ../CVSROOT + COMMIT_FILTER_TEST=$TESTDIR/commit_test_filter.sh + cat > ${COMMIT_FILTER_TEST} < ${COMMIT_FILTER_TEST}.out +echo -n "parameter count: \$#, " >> ${COMMIT_FILTER_TEST}.out +echo "directory: \$1, file: \$3, comment: \"\$2\"" >> ${COMMIT_FILTER_TEST}.out +EOF + chmod +x ${COMMIT_FILTER_TEST} + + echo "ALL $COMMIT_FILTER_TEST %p %m %{s}" >> commitinfo + dotest precommitlog-5 \ + "${testcvs} -q ci -m 'set commitinfo log message filter' commitinfo" \ +"${CVSROOT_DIRNAME}/CVSROOT/commitinfo,v <-- commitinfo +new revision: 1\.2; previous revision: 1\.1 +cvs commit: Rebuilding administrative file database" + cd - > /dev/null + + echo 'line 2' >> file1 + touch $COMMIT_FILTER_TEST.out + dotest precommitlog-6 "${testcvs} -q ci -m \"added 'test line' line2\" file1" \ +"${CVSROOT_DIRNAME}/mydir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1" + dotest precommitlog-7 "cat $COMMIT_FILTER_TEST.out" \ +"testing filter +parameter count: 3, directory: mydir, file: file1, comment: \"added 'test line' line2\"" + + # restore CVSROOT + rm -rf $CVSROOT_DIRNAME/CVSROOT + dotest precommitlog-0 "${testcvs} -d $CVSROOT_DIRNAME init" + cd ../.. + rm -rf 1 cvsroot/mydir + rm -f $TESTDIR/${COMMIT_FILTER_TEST}.out $COMMIT_FILTER_TEST + ;; + + + *) echo $what is not the name of a test -- ignored ;;