merge-recursive: Fix recursive case with D/F conflict via add/add conflict

When a D/F conflict is introduced via an add/add conflict, when o->call_depth > 0 we need to ensure that the higher stage entry from the base stage is removed. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 11, 2011 at 23:19 UTC 7b1c610f84a46fa237627b3307707afb520e555c
2 files changed +4 -2
merge-recursive.c
+2
@@ -1466,6 +1466,8 @@ static int process_df_entry(struct merge_options *o,
1466 "Adding %s as %s",
1467 conf, path, other_branch, path, new_path);
1468 update_file(o, 0, sha, mode, new_path);
1469 + if (o->call_depth)
1470 + remove_file_from_cache(path);
1471 free(new_path);
1472 } else {
1473 output(o, 2, "Adding %s", path);
t/t6036-recursive-corner-cases.sh
+2 -2
@@ -509,7 +509,7 @@ test_expect_failure 'merge of D & E1 fails but has appropriate contents' '
509 test $(git rev-parse :2:a) = $(git rev-parse B:a)
510 '
511
512 -test_expect_failure 'merge of E1 & D fails but has appropriate contents' '
512 +test_expect_success 'merge of E1 & D fails but has appropriate contents' '
513 get_clean_checkout E1^0 &&
514
515 test_must_fail git merge -s recursive D^0 &&
@@ -539,7 +539,7 @@ test_expect_success 'merge of D & E2 fails but has appropriate contents' '
539 test -f a~HEAD
540 '
541
542 -test_expect_failure 'merge of E2 & D fails but has appropriate contents' '
542 +test_expect_success 'merge of E2 & D fails but has appropriate contents' '
543 get_clean_checkout E2^0 &&
544
545 test_must_fail git merge -s recursive D^0 &&