summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-08 05:36:15 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-08 05:36:15 +0000
commit43b83dbfb1ff2497faad39b5321872032bba6b56 (patch)
tree64a5a0c44016352a50bd4eb1a7b82b473fe8b069 /usr.bin/cvs
parentba9a0a8677e961ab7cd1aa003140b74abfbd2ff0 (diff)
avoid resending a directory if it was the last directory sent to the
server
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/proto.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c
index 3408afcb1d6..f6833b4bcdb 100644
--- a/usr.bin/cvs/proto.c
+++ b/usr.bin/cvs/proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proto.c,v 1.31 2004/12/07 17:10:56 tedu Exp $ */
+/* $OpenBSD: proto.c,v 1.32 2004/12/08 05:36:14 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -173,6 +173,9 @@ static FILE *cvs_server_outlog = NULL;
static pid_t cvs_subproc_pid;
+/* last directory sent with cvs_senddir() */
+static char cvs_lastdir[MAXPATHLEN] = "";
+
/*
* cvs_connect()
@@ -930,25 +933,32 @@ cvs_recvraw(struct cvsroot *root, void *dst, size_t len)
/*
* cvs_senddir()
*
- * Send a `Directory' request along with the 2 paths that follow it.
+ * Send a `Directory' request along with the 2 paths that follow it. If
+ * the directory info to be sent is the same as the last info sent, the
+ * call does nothing and simply returns without an error.
*/
int
cvs_senddir(struct cvsroot *root, CVSFILE *dir)
{
char lbuf[MAXPATHLEN], rbuf[MAXPATHLEN];
+ cvs_file_getpath(dir, lbuf, sizeof(lbuf));
+ if (strcmp(lbuf, cvs_lastdir) == 0)
+ return (0);
+
if (dir->cf_ddat->cd_repo == NULL)
strlcpy(rbuf, root->cr_dir, sizeof(rbuf));
else
snprintf(rbuf, sizeof(rbuf), "%s/%s", root->cr_dir,
dir->cf_ddat->cd_repo);
- cvs_file_getpath(dir, lbuf, sizeof(lbuf));
if ((cvs_sendreq(root, CVS_REQ_DIRECTORY, lbuf) < 0) ||
(cvs_sendln(root, rbuf) < 0))
return (-1);
+ strlcpy(cvs_lastdir, lbuf, sizeof(cvs_lastdir));
+
return (0);
}