3 test_description
='RCS merge replacement: merge-file'
9 In loco pascuae ibi me collocavit,
10 super aquam refectionis educavit me;
11 animam meam convertit,
12 deduxit me super semitas jusitiae,
19 In loco pascuae ibi me collocavit,
20 super aquam refectionis educavit me;
21 animam meam convertit,
22 deduxit me super semitas jusitiae,
24 Nam et si ambulavero in medio umbrae mortis,
25 non timebo mala, quoniam tu mecum es:
26 virga tua et baculus tuus ipsa me consolata sunt.
30 Dominus regit me, et nihil mihi deerit.
31 In loco pascuae ibi me collocavit,
32 super aquam refectionis educavit me;
33 animam meam convertit,
34 deduxit me super semitas jusitiae,
41 In loco pascuae ibi me collocavit,
42 super aquam refectionis educavit me;
43 animam meam convertit,
44 deduxit me super semitas jusitiae,
49 Dominus regit me, et nihil mihi deerit.
50 In loco pascuae ibi me collocavit,
51 super aquam refectionis educavit me;
52 animam meam convertit,
53 deduxit me super semitas jusitiae,
55 printf "propter nomen suum." >> new4.txt
58 test_expect_success
"merge without conflict" \
59 "git merge-file test.txt orig.txt new2.txt"
62 test_expect_success
"merge without conflict (missing LF at EOF)" \
63 "git merge-file test2.txt orig.txt new2.txt"
65 test_expect_success
"merge result added missing LF" \
66 "test_cmp test.txt test2.txt"
68 cp test.txt backup.txt
69 test_expect_success
"merge with conflicts" \
70 "test_must_fail git merge-file test.txt orig.txt new3.txt"
72 cat > expect.txt
<< EOF
74 Dominus regit me, et nihil mihi deerit.
79 In loco pascuae ibi me collocavit,
80 super aquam refectionis educavit me;
81 animam meam convertit,
82 deduxit me super semitas jusitiae,
84 Nam et si ambulavero in medio umbrae mortis,
85 non timebo mala, quoniam tu mecum es:
86 virga tua et baculus tuus ipsa me consolata sunt.
89 test_expect_success
"expected conflict markers" "test_cmp test.txt expect.txt"
91 cp backup.txt
test.txt
92 test_expect_success
"merge with conflicts, using -L" \
93 "test_must_fail git merge-file -L 1 -L 2 test.txt orig.txt new3.txt"
95 cat > expect.txt
<< EOF
97 Dominus regit me, et nihil mihi deerit.
100 et nihil mihi deerit.
102 In loco pascuae ibi me collocavit,
103 super aquam refectionis educavit me;
104 animam meam convertit,
105 deduxit me super semitas jusitiae,
107 Nam et si ambulavero in medio umbrae mortis,
108 non timebo mala, quoniam tu mecum es:
109 virga tua et baculus tuus ipsa me consolata sunt.
112 test_expect_success
"expected conflict markers, with -L" \
113 "test_cmp test.txt expect.txt"
115 sed "s/ tu / TU /" < new1.txt
> new5.txt
116 test_expect_success
"conflict in removed tail" \
117 "test_must_fail git merge-file -p orig.txt new1.txt new5.txt > out"
121 et nihil mihi deerit.
122 In loco pascuae ibi me collocavit,
123 super aquam refectionis educavit me;
124 animam meam convertit,
125 deduxit me super semitas jusitiae,
129 Nam et si ambulavero in medio umbrae mortis,
130 non timebo mala, quoniam TU mecum es:
131 virga tua et baculus tuus ipsa me consolata sunt.
135 test_expect_success
"expected conflict markers" "test_cmp expect out"
137 test_expect_success
'binary files cannot be merged' '
138 test_must_fail git merge-file -p \
139 orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err &&
140 grep "Cannot merge binary files" merge.err
143 sed -e "s/deerit.$/deerit;/" -e "s/me;$/me./" < new5.txt
> new6.txt
144 sed -e "s/deerit.$/deerit,/" -e "s/me;$/me,/" < new5.txt
> new7.txt
146 test_expect_success
'MERGE_ZEALOUS simplifies non-conflicts' '
148 test_must_fail git merge-file -p new6.txt new5.txt new7.txt > output &&
149 test 1 = $(grep ======= < output | wc -l)
153 sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit;/" < new6.txt
> new8.txt
154 sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit --/" < new7.txt
> new9.txt
156 test_expect_success
'ZEALOUS_ALNUM' '
158 test_must_fail git merge-file -p \
159 new8.txt new5.txt new9.txt > merge.out &&
160 test 1 = $(grep ======= < merge.out | wc -l)