From 2e9a5cd6e3a9050fccfa9a96f111f9dcf437b23e Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Sat, 27 Jan 2007 21:18:18 +0000 Subject: - 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@ --- usr.bin/cvs/add.c | 13 ++++++++----- 1 file 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 * Copyright (c) 2005, 2006 Xavier Santolaria @@ -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; -- cgit v1.2.3