summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-03 21:08:41 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-03 21:08:41 +0000
commit0709f491634991bbd32906b59cfeab4af82affc5 (patch)
tree617d93e8784c26a8169b01876d73b5b68b324123 /usr.bin
parentce05ff2a7144f28bd7b5ef94f695a572640b4e2b (diff)
When receiving a `Checked-in' response, update the Entries information
correctly. This fixes the problem caused by a commit not updating the information properly and subsequent commands generating a message similar to: Merging differences between 1.X and 1.Y into file file already contains the differences between 1.X and 1.Y
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/resp.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c
index 3b2662ccdcf..f0f25854517 100644
--- a/usr.bin/cvs/resp.c
+++ b/usr.bin/cvs/resp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resp.c,v 1.8 2004/11/26 16:23:50 jfb Exp $ */
+/* $OpenBSD: resp.c,v 1.9 2004/12/03 21:08:40 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -419,12 +419,14 @@ cvs_resp_sticky(struct cvsroot *root, int type, char *line)
* cvs_resp_newentry()
*
* Handler for the `New-entry' response and `Checked-in' responses.
+ * In the case of `New-entry', we expect the entry line
*/
static int
cvs_resp_newentry(struct cvsroot *root, int type, char *line)
{
char entbuf[128];
+ struct cvs_ent *ent;
CVSENTRIES *entfile;
/* get the remote path */
@@ -437,7 +439,27 @@ cvs_resp_newentry(struct cvsroot *root, int type, char *line)
entfile = cvs_ent_open(line, O_WRONLY);
if (entfile == NULL)
return (-1);
- cvs_ent_addln(entfile, entbuf);
+ if (type == CVS_RESP_NEWENTRY) {
+ cvs_ent_addln(entfile, entbuf);
+ }
+ else if (type == CVS_RESP_CHECKEDIN) {
+ ent = cvs_ent_parse(entbuf);
+ if (ent == NULL) {
+ cvs_log(LP_ERR, "failed to parse entry");
+ cvs_ent_close(entfile);
+ return (-1);
+ }
+
+ /* timestamp it to now */
+ ent->ce_mtime = time(&(ent->ce_mtime));
+
+ /* replace the current entry with the one we just received */
+ if (cvs_ent_remove(entfile, ent->ce_name) < 0)
+ cvs_log(LP_WARN, "failed to remove `%s' entry",
+ ent->ce_name);
+
+ cvs_ent_add(entfile, ent);
+ }
cvs_ent_close(entfile);
return (0);