summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2007-01-27 21:18:18 +0000
committerJoris Vink <joris@cvs.openbsd.org>2007-01-27 21:18:18 +0000
commit2e9a5cd6e3a9050fccfa9a96f111f9dcf437b23e (patch)
treed8de614f1a8467cb00c820ac24acd1c98988b5fc
parent7e5bcc31172b7a6247e53e49e22665a16fba6802 (diff)
- do not try to add non-existing files
- do not overwrite the contents of the file when the file was removed and you try to re-add it. ok otto@
-rw-r--r--usr.bin/cvs/add.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index af5ed955fc1..682acfd7dc6 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.72 2007/01/26 21:48:16 xsa Exp $ */
+/* $OpenBSD: add.c,v 1.73 2007/01/27 21:18:17 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -143,7 +143,7 @@ cvs_add_local(struct cvs_file *cf)
{
cvs_log(LP_TRACE, "cvs_add_local(%s)", cf->file_path);
- cvs_file_classify(cf, NULL, 0);
+ cvs_file_classify(cf, NULL, 1);
/* dont use `cvs add *' */
if (strcmp(cf->file_name, ".") == 0 ||
@@ -276,7 +276,7 @@ add_file(struct cvs_file *cf)
if (cf->file_rcs == NULL) {
cvs_log(LP_NOTICE, "cannot resurrect %s; "
"RCS file removed by second party", cf->file_name);
- } else {
+ } else if (cf->fd == -1) {
add_entry(cf);
/* Restore the file. */
@@ -308,11 +308,14 @@ add_file(struct cvs_file *cf)
cvs_log(LP_NOTICE, "re-adding file %s "
"(instead of dead revision %s)",
cf->file_path, revbuf);
- } else {
+ added++;
+ } else if (cf->fd != -1) {
cvs_log(LP_NOTICE, "scheduling file '%s' for addition",
cf->file_path);
+ added++;
+ } else {
+ stop = 1;
}
- added++;
break;
default:
break;