3 # Copyright (c) 2006, Junio C Hamano
6 test_description='fmt-merge-msg test'
10 test_expect_success setup '
14 git commit -m "Initial" &&
22 git commit -a -m "Second" &&
24 git checkout -b left &&
28 git commit -a -m "Common #1" &&
32 git commit -a -m "Common #2" &&
38 git commit -a -m "Left #3" &&
42 git commit -a -m "Left #4" &&
46 git commit -a -m "Left #5" &&
54 git commit -a -m "Right #3" &&
59 git commit -a -m "Right #4" &&
63 git commit -a -m "Right #5" &&
65 git checkout -b long &&
80 test_expect_success 'merge-msg test #1' '
82 git checkout master &&
85 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
86 test_cmp expected actual
90 Merge branch 'left' of $(pwd)
93 test_expect_success 'merge-msg test #2' '
95 git checkout master &&
96 git fetch "$(pwd)" left &&
98 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
99 test_cmp expected actual
113 test_expect_success 'merge-msg test #3-1' '
115 git config --unset-all merge.log
116 git config --unset-all merge.summary
117 git config merge.log true &&
119 git checkout master &&
123 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
124 test_cmp expected actual
127 test_expect_success 'merge-msg test #3-2' '
129 git config --unset-all merge.log
130 git config --unset-all merge.summary
131 git config merge.summary true &&
133 git checkout master &&
137 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
138 test_cmp expected actual
142 Merge branches 'left' and 'right'
159 test_expect_success 'merge-msg test #4-1' '
161 git config --unset-all merge.log
162 git config --unset-all merge.summary
163 git config merge.log true &&
165 git checkout master &&
167 git fetch . left right &&
169 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
170 test_cmp expected actual
173 test_expect_success 'merge-msg test #4-2' '
175 git config --unset-all merge.log
176 git config --unset-all merge.summary
177 git config merge.summary true &&
179 git checkout master &&
181 git fetch . left right &&
183 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
184 test_cmp expected actual
187 test_expect_success 'merge-msg test #5-1' '
189 git config --unset-all merge.log
190 git config --unset-all merge.summary
191 git config merge.log yes &&
193 git checkout master &&
195 git fetch . left right &&
197 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
198 test_cmp expected actual
201 test_expect_success 'merge-msg test #5-2' '
203 git config --unset-all merge.log
204 git config --unset-all merge.summary
205 git config merge.summary yes &&
207 git checkout master &&
209 git fetch . left right &&
211 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
212 test_cmp expected actual
215 test_expect_success 'merge-msg -F' '
217 git config --unset-all merge.log
218 git config --unset-all merge.summary
219 git config merge.summary yes &&
221 git checkout master &&
223 git fetch . left right &&
225 git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
226 test_cmp expected actual
229 test_expect_success 'merge-msg -F in subdirectory' '
231 git config --unset-all merge.log
232 git config --unset-all merge.summary
233 git config merge.summary yes &&
235 git checkout master &&
237 git fetch . left right &&
239 cp .git/FETCH_HEAD sub/FETCH_HEAD &&
242 git fmt-merge-msg -F FETCH_HEAD >../actual
244 test_cmp expected actual
247 test_expect_success 'merge-msg with nothing to merge' '
249 git config --unset-all merge.log
250 git config --unset-all merge.summary
251 git config merge.summary yes &&
255 git checkout -b unrelated &&
258 git fmt-merge-msg <.git/FETCH_HEAD >../actual
261 test_cmp /dev/null actual
273 test_expect_success 'merge-msg tag' '
275 git config --unset-all merge.log
276 git config --unset-all merge.summary
277 git config merge.summary yes &&
279 git checkout master &&
281 git fetch . tag tag-r3 &&
283 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
284 test_cmp expected actual
288 Merge tags 'tag-r3' and 'tag-l5'
303 test_expect_success 'merge-msg two tags' '
305 git config --unset-all merge.log
306 git config --unset-all merge.summary
307 git config merge.summary yes &&
309 git checkout master &&
311 git fetch . tag tag-r3 tag tag-l5 &&
313 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
314 test_cmp expected actual
318 Merge branch 'left', tag 'tag-r3'
333 test_expect_success 'merge-msg tag and branch' '
335 git config --unset-all merge.log
336 git config --unset-all merge.summary
337 git config merge.summary yes &&
339 git checkout master &&
341 git fetch . tag tag-r3 left &&
343 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
344 test_cmp expected actual
353 test_expect_success 'merge-msg lots of commits' '
355 git checkout master &&
365 echo " ..." >>expected
367 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
368 test_cmp expected actual