summaryrefslogtreecommitdiff
path: root/read-tree.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-05-15 00:46:05 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-15 00:46:57 -0700
commit613f02739a49337592a32936caa04b1590ca1109 (patch)
tree42efb6a52eee4d05b824feeb541145f2d8662f86 /read-tree.c
parentSimplify "git reset --hard" (diff)
downloadtgif-613f02739a49337592a32936caa04b1590ca1109.tar.xz
read-tree -u one-way merge fix to check out locally modified paths.
The "-u" flag means "update the working tree files", but to other types of merges, it also implies "I want to keep my local changes" -- because they prevent local changes from getting lost by using verify_uptodate. The one-way merge is different from other merges in that its purpose is opposite of doing something else while keeping unrelated local changes. The point of one-way merge is to nuke local changes. So while it feels somewhat wrong that this actively loses local changes, it is the right thing to do. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'read-tree.c')
-rw-r--r--read-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/read-tree.c b/read-tree.c
index 11157f4242..59b6a6bff9 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -686,6 +686,9 @@ static int oneway_merge(struct cache_entry **src)
if (!a)
return deleted_entry(old, NULL);
if (old && same(old, a)) {
+ struct stat st;
+ if (lstat(old->name, &st) || ce_match_stat(old, &st, 1))
+ old->ce_flags |= htons(CE_UPDATE);
return keep_entry(old);
}
return merged_entry(a, NULL);