Skip to content

Commit ff32340

Browse files
committed
Merge branch 'js/maint-merge-recursive-r-d-conflict'
* js/maint-merge-recursive-r-d-conflict: merge-recursive: mark rename/delete conflict as unmerged
2 parents 4c6e8aa + 36e3b5e commit ff32340

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

merge-recursive.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,11 @@ static int process_renames(struct merge_options *o,
934934
ren1_src, ren1_dst, branch1,
935935
branch2);
936936
update_file(o, 0, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst);
937+
update_stages(ren1_dst, NULL,
938+
branch1 == o->branch1 ?
939+
ren1->pair->two : NULL,
940+
branch1 == o->branch1 ?
941+
NULL : ren1->pair->two, 1);
937942
} else if (!sha_eq(dst_other.sha1, null_sha1)) {
938943
const char *new_path;
939944
clean_merge = 0;

t/t6024-recursive-merge.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,27 @@ test_expect_success 'refuse to merge binary files' '
9797
merge.err
9898
'
9999

100+
test_expect_success 'mark rename/delete as unmerged' '
101+
102+
git reset --hard &&
103+
git checkout -b delete &&
104+
git rm a1 &&
105+
test_tick &&
106+
git commit -m delete &&
107+
git checkout -b rename HEAD^ &&
108+
git mv a1 a2
109+
test_tick &&
110+
git commit -m rename &&
111+
test_must_fail git merge delete &&
112+
test 1 = $(git ls-files --unmerged | wc -l) &&
113+
git rev-parse --verify :2:a2 &&
114+
test_must_fail git rev-parse --verify :3:a2 &&
115+
git checkout -f delete &&
116+
test_must_fail git merge rename &&
117+
test 1 = $(git ls-files --unmerged | wc -l) &&
118+
test_must_fail git rev-parse --verify :2:a2 &&
119+
git rev-parse --verify :3:a2
120+
121+
'
122+
100123
test_done

0 commit comments

Comments
 (0)