Skip to content

Commit

Permalink
read-tree -u one-way merge fix to check out locally modified paths.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed May 15, 2006
1 parent c68998f commit 613f027
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions read-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 613f027

Please sign in to comment.