summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/commit.c
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2005-05-20 05:13:44 +0000
committerjoris <joris@openbsd.org>2005-05-20 05:13:44 +0000
commitef6e385c993023cc3c368b8b17371feaeed3a301 (patch)
tree8e98e8981e1aa8b4a7873636b975a6d4543ef70b /usr.bin/cvs/commit.c
parentdon't attempt to copy the file's tag from the entry if we're dealing (diff)
downloadwireguard-openbsd-ef6e385c993023cc3c368b8b17371feaeed3a301.tar.xz
wireguard-openbsd-ef6e385c993023cc3c368b8b17371feaeed3a301.zip
execute the command callback at the same time we are building
the in-memory filelist. cuts down on execution time for larger trees. "put it in!" jfb@
Diffstat (limited to 'usr.bin/cvs/commit.c')
-rw-r--r--usr.bin/cvs/commit.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index f6f2cb857f2..a4474608c3f 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.31 2005/04/24 02:06:27 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.32 2005/05/20 05:13:44 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -58,6 +58,8 @@ struct cvs_cmd_info cvs_commit = {
};
static char *mfile = NULL;
+static char **commit_files = NULL;
+static int commit_fcount = 0;
int
cvs_commit_options(char *opt, int argc, char **argv, int *arg)
@@ -100,6 +102,10 @@ cvs_commit_options(char *opt, int argc, char **argv, int *arg)
return (CVS_EX_DATA);
*arg = optind;
+
+ commit_files = (argv + optind);
+ commit_fcount = (argc - optind);
+
return (0);
}
@@ -108,16 +114,32 @@ cvs_commit_helper(void)
{
struct cvs_flist cl;
CVSFILE *cfp;
-
+ CVSFILE *tmp;
+ int flags = CF_RECURSE | CF_IGNORE | CF_SORT;
+
SIMPLEQ_INIT(&cl);
- cvs_file_examine(cvs_files, cvs_commit_prepare, &cl);
- if (SIMPLEQ_EMPTY(&cl))
+
+ if (commit_fcount != 0) {
+ tmp = cvs_file_getspec(commit_files, commit_fcount,
+ flags, cvs_commit_prepare, &cl);
+ } else {
+ tmp = cvs_file_get(".", flags, cvs_commit_prepare, &cl);
+ }
+
+ if (tmp == NULL)
+ return (CVS_EX_DATA);
+
+ if (SIMPLEQ_EMPTY(&cl)) {
+ cvs_file_free(tmp);
return (0);
+ }
if (cvs_msg == NULL)
- cvs_msg = cvs_logmsg_get(CVS_FILE_NAME(cvs_files),
+ cvs_msg = cvs_logmsg_get(CVS_FILE_NAME(tmp),
NULL, &cl, NULL);
+ cvs_file_free(tmp);
+
while (!SIMPLEQ_EMPTY(&cl)) {
cfp = SIMPLEQ_FIRST(&cl);
SIMPLEQ_REMOVE_HEAD(&cl, cf_list);