diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-02-04 00:45:54 -0500 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-02-03 22:04:28 -0800 |
commit | 183d79724f6c442f74309dd04c89d3cb48ded628 (patch) | |
tree | d288c01c9a69178cfeb007c35677ca19376475bb /merge-recursive.c | |
parent | 3dff5379bf1e3fda5e5a84ca5813b0c0cfd51be7 (diff) | |
download | git-183d79724f6c442f74309dd04c89d3cb48ded628.tar.gz |
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>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index a5e68457f4..a68fcc6f37 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -891,7 +891,7 @@ static int process_renames(struct path_list *a_renames, struct diff_filespec src_other, dst_other; int try_merge, stage = a_renames == renames1 ? 3: 2; - remove_file(1, ren1_src, index_only); + remove_file(1, ren1_src, index_only || stage == 3); hashcpy(src_other.sha1, ren1->src_entry->stages[stage].sha); src_other.mode = ren1->src_entry->stages[stage].mode; |