From d6f09aff3c300afdba27a7eb6d3f95b5b10b4dde Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 13 Jul 2010 21:33:44 +0000 Subject: [PATCH] Don't silently overwrite untracked local files with newly-added repository files. slightly earlier version ok zinovik xsa --- usr.bin/cvs/update.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index c3563abea2e..7d51f981a74 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.160 2009/03/24 17:03:32 joris Exp $ */ +/* $OpenBSD: update.c,v 1.161 2010/07/13 21:33:44 nicm Exp $ */ /* * Copyright (c) 2006 Joris Vink * @@ -429,9 +429,16 @@ cvs_update_local(struct cvs_file *cf) cf->file_ent->ce_tag != NULL))) flags = CO_SETSTICKY; - cvs_checkout_file(cf, cf->file_rcsrev, tag, flags); - cvs_printf("U %s\n", cf->file_path); - cvs_history_add(CVS_HISTORY_UPDATE_CO, cf, NULL); + if (cf->file_flags & FILE_ON_DISK && (cf->file_ent == NULL || + cf->file_ent->ce_type == CVS_ENT_NONE)) { + cvs_log(LP_ERR, "move away %s; it is in the way", + cf->file_path); + cvs_printf("C %s\n", cf->file_path); + } else { + cvs_checkout_file(cf, cf->file_rcsrev, tag, flags); + cvs_printf("U %s\n", cf->file_path); + cvs_history_add(CVS_HISTORY_UPDATE_CO, cf, NULL); + } break; case FILE_MERGE: d3rev1 = cf->file_ent->ce_rev; -- 2.20.1