3 test_description
='Merge-recursive ours and theirs variants'
6 test_expect_success setup
'
7 for i in 1 2 3 4 5 6 7 8 9
13 git commit -m initial &&
15 sed -e "s/1/one/" -e "s/9/nine/" >file <elif &&
16 git commit -a -m ours &&
18 git checkout -b side HEAD^ &&
20 sed -e "s/9/nueve/" >file <elif &&
21 git commit -a -m theirs &&
26 test_expect_success
'plain recursive - should conflict' '
27 git reset --hard master &&
28 test_must_fail git merge -s recursive side &&
36 test_expect_success
'recursive favouring theirs' '
37 git reset --hard master &&
38 git merge -s recursive -Xtheirs side &&
46 test_expect_success
'recursive favouring ours' '
47 git reset --hard master &&
48 git merge -s recursive -X ours side &&
56 test_expect_success
'binary file with -Xours/-Xtheirs' '
57 echo file binary >.gitattributes &&
59 git reset --hard master &&
60 git merge -s recursive -X theirs side &&
61 git diff --exit-code side HEAD -- file &&
63 git reset --hard master &&
64 git merge -s recursive -X ours side &&
65 git diff --exit-code master HEAD -- file
68 test_expect_success
'pull passes -X to underlying merge' '
69 git reset --hard master && git pull -s recursive -Xours . side &&
70 git reset --hard master && git pull -s recursive -X ours . side &&
71 git reset --hard master && git pull -s recursive -Xtheirs . side &&
72 git reset --hard master && git pull -s recursive -X theirs . side &&
73 git reset --hard master && test_must_fail git pull -s recursive -X bork . side
76 test_expect_success SYMLINKS
'symlink with -Xours/-Xtheirs' '
77 git reset --hard master &&
78 git checkout -b two master &&
79 ln -s target-zero link &&
81 git commit -m "add link pointing to zero" &&
83 ln -f -s target-two link &&
84 git commit -m "add link pointing to two" link &&
86 git checkout -b one HEAD^ &&
87 ln -f -s target-one link &&
88 git commit -m "add link pointing to one" link &&
90 # we expect symbolic links not to resolve automatically, of course
92 test_must_fail git merge -s recursive two &&
94 # favor theirs to resolve to target-two?
97 git merge -s recursive -X theirs two &&
98 git diff --exit-code two HEAD link &&
100 # favor ours to resolve to target-one?
102 git checkout one^0 &&
103 git merge -s recursive -X ours two &&
104 git diff --exit-code one HEAD link