Skip to content

Commit

Permalink
merge-recursive: Fix recursive case with D/F conflict via add/add con…
Browse files Browse the repository at this point in the history
…flict

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>
  • Loading branch information
Elijah Newren authored and Junio C Hamano committed Aug 14, 2011
1 parent 0b30e81 commit 7b1c610
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,8 @@ static int process_df_entry(struct merge_options *o,
"Adding %s as %s",
conf, path, other_branch, path, new_path);
update_file(o, 0, sha, mode, new_path);
if (o->call_depth)
remove_file_from_cache(path);
free(new_path);
} else {
output(o, 2, "Adding %s", path);
Expand Down
4 changes: 2 additions & 2 deletions t/t6036-recursive-corner-cases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ test_expect_failure 'merge of D & E1 fails but has appropriate contents' '
test $(git rev-parse :2:a) = $(git rev-parse B:a)
'

test_expect_failure 'merge of E1 & D fails but has appropriate contents' '
test_expect_success 'merge of E1 & D fails but has appropriate contents' '
get_clean_checkout E1^0 &&
test_must_fail git merge -s recursive D^0 &&
Expand Down Expand Up @@ -539,7 +539,7 @@ test_expect_success 'merge of D & E2 fails but has appropriate contents' '
test -f a~HEAD
'

test_expect_failure 'merge of E2 & D fails but has appropriate contents' '
test_expect_success 'merge of E2 & D fails but has appropriate contents' '
get_clean_checkout E2^0 &&
test_must_fail git merge -s recursive D^0 &&
Expand Down

0 comments on commit 7b1c610

Please sign in to comment.