Keep untracked files not involved in a merge.
commit183d79724f6c442f74309dd04c89d3cb48ded628
authorShawn O. Pearce <spearce@spearce.org>
Sun, 4 Feb 2007 05:45:54 +0000 (4 00:45 -0500)
committerJunio C Hamano <junkio@cox.net>
Sun, 4 Feb 2007 06:04:28 +0000 (3 22:04 -0800)
treed288c01c9a69178cfeb007c35677ca19376475bb
parent3dff5379bf1e3fda5e5a84ca5813b0c0cfd51be7
Keep untracked files not involved in a merge.

My earlier fix (8371234e) to delete renamed tracked files from the
working directory also caused merge-recursive to delete untracked
files that were in the working directory.

The problem here is merge-recursive is deleting the working directory
file without regard for which branch it was associated with.  What we
really want to do during a merge is to only delete files that were
renamed by the branch we are merging into the current branch,
and that are still tracked by the current branch.  These files
definitely don't belong in the working directory anymore.

Anything else is either a merge conflict (already handled in other
parts of the code) or a file that is untracked by the current branch
and thus is not even participating in the merge.  Its this latter
class that must be left alone.

For this fix to work we are now assuming that the first non-base
argument passed to git-merge-recursive always corresponds to the
working directory.  This is already true for all in-tree callers
of merge-recursive.  This assumption is also supported by the
long time usage message of "<base> ... -- <head> <remote>", where
"<head>" is implied to be HEAD, which is generally assumed to be
the current tree-ish.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
merge-recursive.c
t/t6023-merge-rename-nocruft.sh