blob: 2e2fb0e9572f3d570311470aebf47da37974b8f8 [file] [log] [blame]
Junio C Hamano30a95f32006-07-03 18:09:54 -07001#!/bin/sh
2#
3# Copyright (c) 2006, Junio C Hamano
4#
5
6test_description='fmt-merge-msg test'
7
8. ./test-lib.sh
9
Junio C Hamano30a95f32006-07-03 18:09:54 -070010test_expect_success setup '
11 echo one >one &&
12 git add one &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -070013 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070014 git commit -m "Initial" &&
15
Stephen Boyd419fe5b2010-03-24 00:15:58 -070016 git clone . remote &&
17
Junio C Hamano30a95f32006-07-03 18:09:54 -070018 echo uno >one &&
19 echo dos >two &&
20 git add two &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -070021 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070022 git commit -a -m "Second" &&
23
24 git checkout -b left &&
25
Stephen Boyd6183a6a2010-03-24 00:15:59 -070026 echo "c1" >one &&
27 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070028 git commit -a -m "Common #1" &&
29
Stephen Boyd6183a6a2010-03-24 00:15:59 -070030 echo "c2" >one &&
31 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070032 git commit -a -m "Common #2" &&
33
34 git branch right &&
35
Stephen Boyd6183a6a2010-03-24 00:15:59 -070036 echo "l3" >two &&
37 test_tick &&
Junio C Hamano418a1432012-03-13 10:00:00 -070038 GIT_COMMITTER_NAME="Another Committer" \
39 GIT_AUTHOR_NAME="Another Author" git commit -a -m "Left #3" &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070040
Stephen Boyd6183a6a2010-03-24 00:15:59 -070041 echo "l4" >two &&
42 test_tick &&
Junio C Hamano418a1432012-03-13 10:00:00 -070043 GIT_COMMITTER_NAME="Another Committer" \
44 GIT_AUTHOR_NAME="Another Author" git commit -a -m "Left #4" &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070045
Stephen Boyd6183a6a2010-03-24 00:15:59 -070046 echo "l5" >two &&
47 test_tick &&
Junio C Hamano418a1432012-03-13 10:00:00 -070048 GIT_COMMITTER_NAME="Another Committer" \
49 GIT_AUTHOR_NAME="Another Author" git commit -a -m "Left #5" &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -070050 git tag tag-l5 &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070051
52 git checkout right &&
53
Stephen Boyd6183a6a2010-03-24 00:15:59 -070054 echo "r3" >three &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070055 git add three &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -070056 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070057 git commit -a -m "Right #3" &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -070058 git tag tag-r3 &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070059
Stephen Boyd6183a6a2010-03-24 00:15:59 -070060 echo "r4" >three &&
61 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070062 git commit -a -m "Right #4" &&
63
Stephen Boyd6183a6a2010-03-24 00:15:59 -070064 echo "r5" >three &&
65 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070066 git commit -a -m "Right #5" &&
67
Stephen Boyd6d6f6e62010-03-24 00:16:00 -070068 git checkout -b long &&
69 i=0 &&
70 while test $i -lt 30
71 do
72 test_commit $i one &&
73 i=$(($i+1))
74 done &&
75
Jonathan Niederd834c962010-08-17 01:57:40 -050076 git show-branch &&
77
78 apos="'\''"
Junio C Hamano30a95f32006-07-03 18:09:54 -070079'
80
Jonathan Niederd834c962010-08-17 01:57:40 -050081test_expect_success 'message for merging local branch' '
82 echo "Merge branch ${apos}left${apos}" >expected &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070083
84 git checkout master &&
85 git fetch . left &&
86
87 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
Junio C Hamano3af82862008-05-23 22:28:56 -070088 test_cmp expected actual
Junio C Hamano30a95f32006-07-03 18:09:54 -070089'
90
Jonathan Niederd834c962010-08-17 01:57:40 -050091test_expect_success 'message for merging external branch' '
92 echo "Merge branch ${apos}left${apos} of $(pwd)" >expected &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070093
94 git checkout master &&
Johannes Sixt41141562009-03-13 23:35:24 +010095 git fetch "$(pwd)" left &&
Junio C Hamano30a95f32006-07-03 18:09:54 -070096
97 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
Junio C Hamano3af82862008-05-23 22:28:56 -070098 test_cmp expected actual
Junio C Hamano30a95f32006-07-03 18:09:54 -070099'
100
Jonathan Niederd834c962010-08-17 01:57:40 -0500101test_expect_success '[merge] summary/log configuration' '
102 cat >expected <<-EOF &&
103 Merge branch ${apos}left${apos}
Junio C Hamano30a95f32006-07-03 18:09:54 -0700104
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700105 # By Another Author (3) and A U Thor (2)
106 # Via Another Committer
Jonathan Niederd834c962010-08-17 01:57:40 -0500107 * left:
108 Left #5
109 Left #4
110 Left #3
111 Common #2
112 Common #1
113 EOF
Junio C Hamano30a95f32006-07-03 18:09:54 -0700114
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700115 test_config merge.log true &&
116 test_unconfig merge.summary &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200117
118 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700119 test_tick &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200120 git fetch . left &&
121
Jonathan Niederd834c962010-08-17 01:57:40 -0500122 git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200123
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700124 test_unconfig merge.log &&
125 test_config merge.summary true &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700126
127 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700128 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700129 git fetch . left &&
130
Jonathan Niederd834c962010-08-17 01:57:40 -0500131 git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
132
133 test_cmp expected actual1 &&
134 test_cmp expected actual2
Junio C Hamano30a95f32006-07-03 18:09:54 -0700135'
136
Ramkumar Ramachandrab928cbf2010-09-08 23:29:56 +0530137test_expect_success 'setup FETCH_HEAD' '
138 git checkout master &&
139 test_tick &&
140 git fetch . left
141'
142
143test_expect_success 'merge.log=3 limits shortlog length' '
144 cat >expected <<-EOF &&
145 Merge branch ${apos}left${apos}
146
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700147 # By Another Author (3) and A U Thor (2)
148 # Via Another Committer
Ramkumar Ramachandrab928cbf2010-09-08 23:29:56 +0530149 * left: (5 commits)
150 Left #5
151 Left #4
152 Left #3
153 ...
154 EOF
155
156 git -c merge.log=3 fmt-merge-msg <.git/FETCH_HEAD >actual &&
157 test_cmp expected actual
158'
159
160test_expect_success 'merge.log=5 shows all 5 commits' '
161 cat >expected <<-EOF &&
162 Merge branch ${apos}left${apos}
163
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700164 # By Another Author (3) and A U Thor (2)
165 # Via Another Committer
Ramkumar Ramachandrab928cbf2010-09-08 23:29:56 +0530166 * left:
167 Left #5
168 Left #4
169 Left #3
170 Common #2
171 Common #1
172 EOF
173
174 git -c merge.log=5 fmt-merge-msg <.git/FETCH_HEAD >actual &&
175 test_cmp expected actual
176'
177
Ralf Thielow9927ebe2013-04-07 17:25:43 +0200178test_expect_success '--log=5 with custom comment character' '
179 cat >expected <<-EOF &&
180 Merge branch ${apos}left${apos}
181
Johannes Sixt16a794d2013-04-18 08:42:25 +0200182 x By Another Author (3) and A U Thor (2)
183 x Via Another Committer
Ralf Thielow9927ebe2013-04-07 17:25:43 +0200184 * left:
185 Left #5
186 Left #4
187 Left #3
188 Common #2
189 Common #1
190 EOF
191
Johannes Sixt16a794d2013-04-18 08:42:25 +0200192 git -c core.commentchar="x" fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
Ralf Thielow9927ebe2013-04-07 17:25:43 +0200193 test_cmp expected actual
194'
195
Ramkumar Ramachandrab928cbf2010-09-08 23:29:56 +0530196test_expect_success 'merge.log=0 disables shortlog' '
Jeff King99094a72015-03-20 06:07:15 -0400197 echo "Merge branch ${apos}left${apos}" >expected &&
Ramkumar Ramachandrab928cbf2010-09-08 23:29:56 +0530198 git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
199 test_cmp expected actual
200'
201
Ramkumar Ramachandrabd2549c2010-09-08 23:29:57 +0530202test_expect_success '--log=3 limits shortlog length' '
203 cat >expected <<-EOF &&
204 Merge branch ${apos}left${apos}
205
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700206 # By Another Author (3) and A U Thor (2)
207 # Via Another Committer
Ramkumar Ramachandrabd2549c2010-09-08 23:29:57 +0530208 * left: (5 commits)
209 Left #5
210 Left #4
211 Left #3
212 ...
213 EOF
214
215 git fmt-merge-msg --log=3 <.git/FETCH_HEAD >actual &&
216 test_cmp expected actual
217'
218
219test_expect_success '--log=5 shows all 5 commits' '
220 cat >expected <<-EOF &&
221 Merge branch ${apos}left${apos}
222
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700223 # By Another Author (3) and A U Thor (2)
224 # Via Another Committer
Ramkumar Ramachandrabd2549c2010-09-08 23:29:57 +0530225 * left:
226 Left #5
227 Left #4
228 Left #3
229 Common #2
230 Common #1
231 EOF
232
233 git fmt-merge-msg --log=5 <.git/FETCH_HEAD >actual &&
234 test_cmp expected actual
235'
236
237test_expect_success '--no-log disables shortlog' '
238 echo "Merge branch ${apos}left${apos}" >expected &&
239 git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&
240 test_cmp expected actual
241'
242
243test_expect_success '--log=0 disables shortlog' '
244 echo "Merge branch ${apos}left${apos}" >expected &&
245 git fmt-merge-msg --no-log <.git/FETCH_HEAD >actual &&
246 test_cmp expected actual
247'
248
Jonathan Nieder21024402010-08-17 18:00:34 -0500249test_expect_success 'fmt-merge-msg -m' '
250 echo "Sync with left" >expected &&
251 cat >expected.log <<-EOF &&
252 Sync with left
253
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700254 # By Another Author (3) and A U Thor (2)
255 # Via Another Committer
Jonathan Nieder21024402010-08-17 18:00:34 -0500256 * ${apos}left${apos} of $(pwd):
257 Left #5
258 Left #4
259 Left #3
260 Common #2
261 Common #1
262 EOF
263
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700264 test_unconfig merge.log &&
265 test_unconfig merge.summary &&
Jonathan Nieder21024402010-08-17 18:00:34 -0500266 git checkout master &&
267 git fetch "$(pwd)" left &&
268 git fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual &&
269 git fmt-merge-msg --log -m "Sync with left" \
270 <.git/FETCH_HEAD >actual.log &&
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700271 test_config merge.log true &&
Jonathan Nieder21024402010-08-17 18:00:34 -0500272 git fmt-merge-msg -m "Sync with left" \
273 <.git/FETCH_HEAD >actual.log-config &&
274 git fmt-merge-msg --no-log -m "Sync with left" \
275 <.git/FETCH_HEAD >actual.nolog &&
276
277 test_cmp expected actual &&
278 test_cmp expected.log actual.log &&
279 test_cmp expected.log actual.log-config &&
280 test_cmp expected actual.nolog
281'
282
Jonathan Niederd834c962010-08-17 01:57:40 -0500283test_expect_success 'setup: expected shortlog for two branches' '
284 cat >expected <<-EOF
285 Merge branches ${apos}left${apos} and ${apos}right${apos}
Junio C Hamano30a95f32006-07-03 18:09:54 -0700286
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700287 # By Another Author (3) and A U Thor (2)
288 # Via Another Committer
Jonathan Niederd834c962010-08-17 01:57:40 -0500289 * left:
290 Left #5
291 Left #4
292 Left #3
293 Common #2
294 Common #1
Junio C Hamano30a95f32006-07-03 18:09:54 -0700295
Jonathan Niederd834c962010-08-17 01:57:40 -0500296 * right:
297 Right #5
298 Right #4
299 Right #3
300 Common #2
301 Common #1
302 EOF
303'
Junio C Hamano30a95f32006-07-03 18:09:54 -0700304
Jonathan Niederd834c962010-08-17 01:57:40 -0500305test_expect_success 'shortlog for two branches' '
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700306 test_config merge.log true &&
307 test_unconfig merge.summary &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200308 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700309 test_tick &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200310 git fetch . left right &&
Jonathan Niederd834c962010-08-17 01:57:40 -0500311 git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200312
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700313 test_unconfig merge.log &&
314 test_config merge.summary true &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700315 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700316 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700317 git fetch . left right &&
Jonathan Niederd834c962010-08-17 01:57:40 -0500318 git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700319
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700320 test_config merge.log yes &&
321 test_unconfig merge.summary &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200322 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700323 test_tick &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200324 git fetch . left right &&
Jonathan Niederd834c962010-08-17 01:57:40 -0500325 git fmt-merge-msg <.git/FETCH_HEAD >actual3 &&
SZEDER Gábor6cd9cfe2008-04-06 03:23:45 +0200326
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700327 test_unconfig merge.log &&
328 test_config merge.summary yes &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700329 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700330 test_tick &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700331 git fetch . left right &&
Jonathan Niederd834c962010-08-17 01:57:40 -0500332 git fmt-merge-msg <.git/FETCH_HEAD >actual4 &&
Junio C Hamano30a95f32006-07-03 18:09:54 -0700333
Jonathan Niederd834c962010-08-17 01:57:40 -0500334 test_cmp expected actual1 &&
335 test_cmp expected actual2 &&
336 test_cmp expected actual3 &&
337 test_cmp expected actual4
Junio C Hamano30a95f32006-07-03 18:09:54 -0700338'
339
Stephen Boyd4c8d4c12009-05-23 11:53:11 -0700340test_expect_success 'merge-msg -F' '
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700341 test_unconfig merge.log &&
342 test_config merge.summary yes &&
Stephen Boyd4c8d4c12009-05-23 11:53:11 -0700343 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700344 test_tick &&
Stephen Boyd4c8d4c12009-05-23 11:53:11 -0700345 git fetch . left right &&
Stephen Boyd4c8d4c12009-05-23 11:53:11 -0700346 git fmt-merge-msg -F .git/FETCH_HEAD >actual &&
347 test_cmp expected actual
348'
349
350test_expect_success 'merge-msg -F in subdirectory' '
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700351 test_unconfig merge.log &&
352 test_config merge.summary yes &&
Stephen Boyd4c8d4c12009-05-23 11:53:11 -0700353 git checkout master &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700354 test_tick &&
Stephen Boyd4c8d4c12009-05-23 11:53:11 -0700355 git fetch . left right &&
356 mkdir sub &&
357 cp .git/FETCH_HEAD sub/FETCH_HEAD &&
358 (
359 cd sub &&
360 git fmt-merge-msg -F FETCH_HEAD >../actual
361 ) &&
362 test_cmp expected actual
363'
364
Stephen Boyd419fe5b2010-03-24 00:15:58 -0700365test_expect_success 'merge-msg with nothing to merge' '
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700366 test_unconfig merge.log &&
367 test_config merge.summary yes &&
Stephen Boyd419fe5b2010-03-24 00:15:58 -0700368
Jonathan Niederd834c962010-08-17 01:57:40 -0500369 >empty &&
370
Stephen Boyd419fe5b2010-03-24 00:15:58 -0700371 (
372 cd remote &&
373 git checkout -b unrelated &&
Stephen Boyd6183a6a2010-03-24 00:15:59 -0700374 test_tick &&
Stephen Boyd419fe5b2010-03-24 00:15:58 -0700375 git fetch origin &&
376 git fmt-merge-msg <.git/FETCH_HEAD >../actual
377 ) &&
378
Jonathan Niederd834c962010-08-17 01:57:40 -0500379 test_cmp empty actual
Stephen Boyd419fe5b2010-03-24 00:15:58 -0700380'
381
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700382test_expect_success 'merge-msg tag' '
Jonathan Niederd834c962010-08-17 01:57:40 -0500383 cat >expected <<-EOF &&
384 Merge tag ${apos}tag-r3${apos}
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700385
Jonathan Niederd834c962010-08-17 01:57:40 -0500386 * tag ${apos}tag-r3${apos}:
387 Right #3
388 Common #2
389 Common #1
390 EOF
391
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700392 test_unconfig merge.log &&
393 test_config merge.summary yes &&
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700394
395 git checkout master &&
396 test_tick &&
397 git fetch . tag tag-r3 &&
398
399 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
400 test_cmp expected actual
401'
402
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700403test_expect_success 'merge-msg two tags' '
Jonathan Niederd834c962010-08-17 01:57:40 -0500404 cat >expected <<-EOF &&
405 Merge tags ${apos}tag-r3${apos} and ${apos}tag-l5${apos}
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700406
Jonathan Niederd834c962010-08-17 01:57:40 -0500407 * tag ${apos}tag-r3${apos}:
408 Right #3
409 Common #2
410 Common #1
411
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700412 # By Another Author (3) and A U Thor (2)
413 # Via Another Committer
Jonathan Niederd834c962010-08-17 01:57:40 -0500414 * tag ${apos}tag-l5${apos}:
415 Left #5
416 Left #4
417 Left #3
418 Common #2
419 Common #1
420 EOF
421
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700422 test_unconfig merge.log &&
423 test_config merge.summary yes &&
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700424
425 git checkout master &&
426 test_tick &&
427 git fetch . tag tag-r3 tag tag-l5 &&
428
429 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
430 test_cmp expected actual
431'
432
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700433test_expect_success 'merge-msg tag and branch' '
Jonathan Niederd834c962010-08-17 01:57:40 -0500434 cat >expected <<-EOF &&
435 Merge branch ${apos}left${apos}, tag ${apos}tag-r3${apos}
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700436
Jonathan Niederd834c962010-08-17 01:57:40 -0500437 * tag ${apos}tag-r3${apos}:
438 Right #3
439 Common #2
440 Common #1
441
Junio C Hamano9830a9c2012-06-06 14:24:28 -0700442 # By Another Author (3) and A U Thor (2)
443 # Via Another Committer
Jonathan Niederd834c962010-08-17 01:57:40 -0500444 * left:
445 Left #5
446 Left #4
447 Left #3
448 Common #2
449 Common #1
450 EOF
451
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700452 test_unconfig merge.log &&
453 test_config merge.summary yes &&
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700454
455 git checkout master &&
456 test_tick &&
457 git fetch . tag tag-r3 left &&
458
459 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
460 test_cmp expected actual
461'
462
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700463test_expect_success 'merge-msg lots of commits' '
Jonathan Niederd834c962010-08-17 01:57:40 -0500464 {
465 cat <<-EOF &&
466 Merge branch ${apos}long${apos}
467
468 * long: (35 commits)
469 EOF
470
471 i=29 &&
472 while test $i -gt 9
473 do
474 echo " $i" &&
475 i=$(($i-1))
476 done &&
477 echo " ..."
478 } >expected &&
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700479
Junio C Hamano9a94dba2013-04-01 12:33:52 -0700480 test_config merge.summary yes &&
481
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700482 git checkout master &&
483 test_tick &&
484 git fetch . long &&
485
Stephen Boyd6d6f6e62010-03-24 00:16:00 -0700486 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
487 test_cmp expected actual
488'
489
Junio C Hamanoa38d3d72013-04-01 12:51:50 -0700490test_expect_success 'merge-msg with "merging" an annotated tag' '
491 test_config merge.log true &&
492
493 git checkout master^0 &&
494 git commit --allow-empty -m "One step ahead" &&
495 git tag -a -m "An annotated one" annote HEAD &&
496
497 git checkout master &&
498 git fetch . annote &&
499
500 git fmt-merge-msg <.git/FETCH_HEAD >actual &&
501 {
502 cat <<-\EOF
503 Merge tag '\''annote'\''
504
505 An annotated one
506
507 * tag '\''annote'\'':
508 One step ahead
509 EOF
510 } >expected &&
511 test_cmp expected actual &&
512
513 test_when_finished "git reset --hard" &&
514 annote=$(git rev-parse annote) &&
515 git merge --no-commit $annote &&
516 {
517 cat <<-EOF
518 Merge tag '\''$annote'\''
519
520 An annotated one
521
522 * tag '\''$annote'\'':
523 One step ahead
524 EOF
525 } >expected &&
526 test_cmp expected .git/MERGE_MSG
527'
528
Junio C Hamano30a95f32006-07-03 18:09:54 -0700529test_done