3 test_description='checkout -m -- <conflicted path>
5 Ensures that checkout -m on a resolved file restores the conflicted file'
9 test_expect_success setup '
11 test_commit both.txt both.txt initial &&
13 test_commit modified_in_master both.txt in_master &&
14 test_commit added_in_master each.txt in_master &&
16 test_commit modified_in_topic both.txt in_topic &&
17 test_commit added_in_topic each.txt in_topic
20 test_must_fail git merge master
22 clean_branchnames () {
23 # Remove branch names after conflict lines
24 sed 's/^\([<>]\{5,\}\) .*$/\1/'
27 test_expect_success '-m restores 2-way conflicted+resolved file' '
28 cp each.txt each.txt.conflicted &&
29 echo resolved >each.txt &&
31 git checkout -m -- each.txt &&
32 clean_branchnames <each.txt >each.txt.cleaned &&
33 clean_branchnames <each.txt.conflicted >each.txt.conflicted.cleaned &&
34 test_cmp each.txt.conflicted.cleaned each.txt.cleaned
37 test_expect_success '-m restores 3-way conflicted+resolved file' '
38 cp both.txt both.txt.conflicted &&
39 echo resolved >both.txt &&
41 git checkout -m -- both.txt &&
42 clean_branchnames <both.txt >both.txt.cleaned &&
43 clean_branchnames <both.txt.conflicted >both.txt.conflicted.cleaned &&
44 test_cmp both.txt.conflicted.cleaned both.txt.cleaned