summaryrefslogtreecommitdiffstats
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-17 02:39:06 +0100
committerJunio C Hamano <junkio@cox.net>2006-12-17 10:14:44 +0100
commit81a361be3b12f393d402c5da63191c11c18ea6a9 (patch)
tree5f0b4d5c59c5e3aab6820c516628c51b86e1fe4a /read-cache.c
parentgit-add: remove conflicting entry when adding. (diff)
downloadgit-81a361be3b12f393d402c5da63191c11c18ea6a9.tar.xz
git-81a361be3b12f393d402c5da63191c11c18ea6a9.zip
Fix check_file_directory_conflict().
When replacing an existing file A with a directory A that has a file A/B in it in the index, 'update-index --replace --add A/B' did not properly remove the file to make room for the new directory. There was a trivial logic error, most likely a cut & paste one, dating back to quite early days of git. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index 983e68b892..b8d83ccd9f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -517,7 +517,7 @@ static int has_dir_name(const struct cache_entry *ce, int pos, int ok_to_replace
pos = cache_name_pos(name, ntohs(create_ce_flags(len, stage)));
if (pos >= 0) {
retval = -1;
- if (ok_to_replace)
+ if (!ok_to_replace)
break;
remove_cache_entry_at(pos);
continue;