@matheusbsbs / matheus-bagliano / commits / 6d6f6e68c3
Fork 0

t6200: test fmt-merge-msg more

Add some more tests so we don't break behavior upon modernizing fmt-merge-msg. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stephen Boyd committed Mar 24, 2010 at 00:16 UTC 6d6f6e68c3e2a18c3f02eba98e35ea13204ec68e
1 file changed +115
t/t6200-fmt-merge-msg.sh
+115
@@ -62,6 +62,14 @@ test_expect_success setup '
62 test_tick &&
63 git commit -a -m "Right #5" &&
64
65 + git checkout -b long &&
66 + i=0 &&
67 + while test $i -lt 30
68 + do
69 + test_commit $i one &&
70 + i=$(($i+1))
71 + done &&
72 +
73 git show-branch
74 '
75
@@ -253,4 +261,111 @@ test_expect_success 'merge-msg with nothing to merge' '
261 test_cmp /dev/null actual
262 '
263
264 +cat >expected <<\EOF
265 +Merge tag 'tag-r3'
266 +
267 +* tag 'tag-r3':
268 + Right #3
269 + Common #2
270 + Common #1
271 +EOF
272 +
273 +test_expect_success 'merge-msg tag' '
274 +
275 + git config --unset-all merge.log
276 + git config --unset-all merge.summary
277 + git config merge.summary yes &&
278 +
279 + git checkout master &&
280 + test_tick &&
281 + git fetch . tag tag-r3 &&
282 +
283 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
284 + test_cmp expected actual
285 +'
286 +
287 +cat >expected <<\EOF
288 +Merge tags 'tag-r3' and 'tag-l5'
289 +
290 +* tag 'tag-r3':
291 + Right #3
292 + Common #2
293 + Common #1
294 +
295 +* tag 'tag-l5':
296 + Left #5
297 + Left #4
298 + Left #3
299 + Common #2
300 + Common #1
301 +EOF
302 +
303 +test_expect_success 'merge-msg two tags' '
304 +
305 + git config --unset-all merge.log
306 + git config --unset-all merge.summary
307 + git config merge.summary yes &&
308 +
309 + git checkout master &&
310 + test_tick &&
311 + git fetch . tag tag-r3 tag tag-l5 &&
312 +
313 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
314 + test_cmp expected actual
315 +'
316 +
317 +cat >expected <<\EOF
318 +Merge branch 'left', tag 'tag-r3'
319 +
320 +* tag 'tag-r3':
321 + Right #3
322 + Common #2
323 + Common #1
324 +
325 +* left:
326 + Left #5
327 + Left #4
328 + Left #3
329 + Common #2
330 + Common #1
331 +EOF
332 +
333 +test_expect_success 'merge-msg tag and branch' '
334 +
335 + git config --unset-all merge.log
336 + git config --unset-all merge.summary
337 + git config merge.summary yes &&
338 +
339 + git checkout master &&
340 + test_tick &&
341 + git fetch . tag tag-r3 left &&
342 +
343 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
344 + test_cmp expected actual
345 +'
346 +
347 +cat >expected <<\EOF
348 +Merge branch 'long'
349 +
350 +* long: (35 commits)
351 +EOF
352 +
353 +test_expect_success 'merge-msg lots of commits' '
354 +
355 + git checkout master &&
356 + test_tick &&
357 + git fetch . long &&
358 +
359 + i=29 &&
360 + while test $i -gt 9
361 + do
362 + echo " $i" &&
363 + i=$(($i-1))
364 + done >>expected &&
365 + echo " ..." >>expected
366 +
367 + git fmt-merge-msg <.git/FETCH_HEAD >actual &&
368 + test_cmp expected actual
369 +'
370 +
371 test_done