summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/commit.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-08-29 09:54:23 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-08-29 09:54:23 +0000
commit70f8ff43495eccb24cff14a6387bcc43041808bb (patch)
tree111e3ea8787439a13bceebea7901cbde68db40b0 /usr.bin/cvs/commit.c
parent99c57fa5e069bb01df659d9ce61697f866e523c0 (diff)
Pre-commit checks (CVSROOT/commitinfo) are run before log message is
requested. Do this for GNU cvs compatibility, too. ok joris
Diffstat (limited to 'usr.bin/cvs/commit.c')
-rw-r--r--usr.bin/cvs/commit.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index b164f2baad4..f2a86bf08f6 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.144 2008/07/08 12:54:13 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.145 2008/08/29 09:54:22 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -135,15 +135,13 @@ cvs_commit(int argc, char **argv)
if (TAILQ_EMPTY(&files_affected))
return (0);
- if (logmsg == NULL && cvs_server_active == 0) {
- logmsg = cvs_logmsg_create(NULL, &files_added, &files_removed,
- &files_modified);
-
- if (logmsg == NULL)
- fatal("This shouldnt happen, honestly!");
- }
-
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (logmsg == NULL) {
+ logmsg = cvs_logmsg_create(NULL, &files_added,
+ &files_removed, &files_modified);
+ if (logmsg == NULL)
+ fatal("This shouldnt happen, honestly!");
+ }
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -161,9 +159,6 @@ cvs_commit(int argc, char **argv)
cvs_client_send_request("ci");
cvs_client_get_responses();
} else {
- if (cvs_server_active && logmsg == NULL)
- fatal("no log message specified");
-
cvs_get_repository_name(".", repo, MAXPATHLEN);
line_list = cvs_trigger_getlines(CVS_PATH_COMMITINFO, repo);
@@ -187,6 +182,16 @@ cvs_commit(int argc, char **argv)
cvs_trigger_freeinfo(&files_info);
}
+ if (cvs_server_active) {
+ if (logmsg == NULL)
+ fatal("no log message specified");
+ } else if (logmsg == NULL) {
+ logmsg = cvs_logmsg_create(NULL, &files_added,
+ &files_removed, &files_modified);
+ if (logmsg == NULL)
+ fatal("This shouldnt happen, honestly!");
+ }
+
if (cvs_logmsg_verify(logmsg))
goto end;
@@ -217,7 +222,8 @@ cvs_commit(int argc, char **argv)
end:
cvs_trigger_freeinfo(&files_info);
- xfree(logmsg);
+ if (logmsg != NULL)
+ xfree(logmsg);
return (0);
}