diff options
author | Dave Olszewski <cxreg@pobox.com> | 2009-05-09 14:49:59 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-09 21:05:52 -0700 |
commit | bf74106a5b4577fd695d15a28ad51537ae7470d8 (patch) | |
tree | 8e6f36a9a3c472f11eb40e073d0e05cef963c100 /merge-recursive.c | |
parent | a48f5d7153761fabf0b04fdfd1667adf7eeeddbe (diff) | |
download | git-bf74106a5b4577fd695d15a28ad51537ae7470d8.tar.gz |
merge-recursive: never leave index unmerged while recursing
When you are trying to come up with the final result (i.e. depth=0), you
want to record how the conflict arose by registering the state of the
common ancestor, your branch and the other branch in the index, hence you
want to do update_stages().
When you are merging with positive depth, that is because of a criss-cross
merge situation. In such a case, you would need to record the tentative
result, with conflict markers and all, as if the merge went cleanly, even
if there are conflicts, in order to write it out as a tree object later to
be used as a common ancestor tree.
update_file() calls update_file_flags() with update_cache=1 to signal that
the result needs to be written to the index at stage #0 (i.e. merged), and
the code should not clobber the index further by calling update_stages().
The codepath to deal with rename/delete conflict in a recursive merge
however left the index unmerged.
Signed-off-by: Dave Olszewski <cxreg@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 9bf5cc7175..2f1025c2aa 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -934,11 +934,12 @@ static int process_renames(struct merge_options *o, ren1_src, ren1_dst, branch1, branch2); update_file(o, 0, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst); - update_stages(ren1_dst, NULL, - branch1 == o->branch1 ? - ren1->pair->two : NULL, - branch1 == o->branch1 ? - NULL : ren1->pair->two, 1); + if (!o->call_depth) + update_stages(ren1_dst, NULL, + branch1 == o->branch1 ? + ren1->pair->two : NULL, + branch1 == o->branch1 ? + NULL : ren1->pair->two, 1); } else if (!sha_eq(dst_other.sha1, null_sha1)) { const char *new_path; clean_merge = 0; |