summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/add.c14
-rw-r--r--usr.bin/cvs/client.c37
2 files changed, 39 insertions, 12 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 663883c54a1..5deb16536aa 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.83 2008/01/10 09:37:26 tobias Exp $ */
+/* $OpenBSD: add.c,v 1.84 2008/01/10 09:41:52 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -380,7 +380,13 @@ add_entry(struct cvs_file *cf)
(kflag != RCS_KWEXP_DEFAULT) ? kbuf : "");
}
- entlist = cvs_ent_open(cf->file_wd);
- cvs_ent_add(entlist, entry);
- cvs_ent_close(entlist, ENT_SYNC);
+ if (cvs_server_active) {
+ cvs_server_send_response("Checked-in %s/", cf->file_wd);
+ cvs_server_send_response(cf->file_path);
+ cvs_server_send_response(entry);
+ } else {
+ entlist = cvs_ent_open(cf->file_wd);
+ cvs_ent_add(entlist, entry);
+ cvs_ent_close(entlist, ENT_SYNC);
+ }
}
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index f5904142526..56e7028f671 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.83 2007/11/11 09:51:49 tobias Exp $ */
+/* $OpenBSD: client.c,v 1.84 2008/01/10 09:41:52 tobias Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -500,6 +500,9 @@ cvs_client_sendfile(struct cvs_file *cf)
cf->file_ent->ce_opts : "", sticky);
}
+ if (cvs_cmdop == CVS_OP_ADD)
+ cf->file_status = FILE_MODIFIED;
+
switch (cf->file_status) {
case FILE_UNKNOWN:
if (cf->fd != -1)
@@ -595,6 +598,7 @@ cvs_client_checkedin(char *data)
{
CVSENTRIES *entlist;
struct cvs_ent *ent, *newent;
+ size_t len;
char *dir, *e, entry[CVS_ENT_MAXLINELEN], rev[CVS_REV_BUFSZ];
char sticky[CVS_ENT_MAXLINELEN], timebuf[CVS_TIME_BUFSZ];
@@ -611,19 +615,36 @@ cvs_client_checkedin(char *data)
xfree(e);
rcsnum_tostr(newent->ce_rev, rev, sizeof(rev));
- ctime_r(&ent->ce_mtime, timebuf);
- if (timebuf[strlen(timebuf) - 1] == '\n')
- timebuf[strlen(timebuf) - 1] = '\0';
sticky[0] = '\0';
- if (ent->ce_tag != NULL)
- (void)xsnprintf(sticky, sizeof(sticky), "T%s", ent->ce_tag);
+ if (ent == NULL) {
+ len = strlcpy(rev, "0", sizeof(rev));
+ if (len >= sizeof(rev))
+ fatal("cvs_client_sendfile: truncation");
+
+ len = strlcpy(timebuf, "Initial ", sizeof(timebuf));
+ if (len >= sizeof(timebuf))
+ fatal("cvs_client_sendfile: truncation");
+
+ len = strlcat(timebuf, newent->ce_name, sizeof(timebuf));
+ if (len >= sizeof(timebuf))
+ fatal("cvs_client_sendfile: truncation");
+ } else {
+ ctime_r(&ent->ce_mtime, timebuf);
+ timebuf[strcspn(timebuf, "\n")] = '\0';
+
+ if (newent->ce_tag != NULL)
+ (void)xsnprintf(sticky, sizeof(sticky), "T%s",
+ ent->ce_tag);
+ newent->ce_opts = ent->ce_opts;
+
+ cvs_ent_free(ent);
+ }
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s%s/%s/%s/%s",
newent->ce_name, (newent->ce_status == CVS_ENT_REMOVED) ? "-" : "",
- rev, timebuf, ent->ce_opts ? ent->ce_opts : "", sticky);
+ rev, timebuf, newent->ce_opts ? newent->ce_opts : "", sticky);
- cvs_ent_free(ent);
cvs_ent_free(newent);
cvs_ent_add(entlist, entry);
cvs_ent_close(entlist, ENT_SYNC);