summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-07-16 23:25:12 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-07-16 23:25:12 -0700
commitf8f0b1f0e7e96bf996c657d2c5c15e0ba3a4eeac (patch)
treedae37badcba43ea7116fbe9c5dd5512a4696ff76
parentgit-svn: don't check for migrations/upgrades on commit-diff (diff)
downloadtgif-f8f0b1f0e7e96bf996c657d2c5c15e0ba3a4eeac.tar.xz
checkout -f failed to check out a file if an existing directory interfered.
When path foo/bar existed in the working tree, checkout -f to switch to a branch that has a file foo silently did a wrong thing. It failed to remove the directory foo, did not check out the file foo, and the worst of all it did not report any errors. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--builtin-read-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 6df5d7c5cb..122b6f130b 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -507,7 +507,7 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old)
}
merge->ce_flags &= ~htons(CE_STAGEMASK);
- add_cache_entry(merge, ADD_CACHE_OK_TO_ADD);
+ add_cache_entry(merge, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
return 1;
}
@@ -518,7 +518,7 @@ static int deleted_entry(struct cache_entry *ce, struct cache_entry *old)
else
verify_absent(ce->name, "removed");
ce->ce_mode = 0;
- add_cache_entry(ce, ADD_CACHE_OK_TO_ADD);
+ add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
invalidate_ce_path(ce);
return 1;
}