@@ -112,17 +112,17 @@ test_expect_success '[merge] summary/log configuration' '
112112 Common #1
113113 EOF
114114
115- git config merge.log true &&
116- test_might_fail git config --unset-all merge.summary &&
115+ test_config merge.log true &&
116+ test_unconfig merge.summary &&
117117
118118 git checkout master &&
119119 test_tick &&
120120 git fetch . left &&
121121
122122 git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
123123
124- test_might_fail git config --unset-all merge.log &&
125- git config merge.summary true &&
124+ test_unconfig merge.log &&
125+ test_config merge.summary true &&
126126
127127 git checkout master &&
128128 test_tick &&
@@ -134,11 +134,6 @@ test_expect_success '[merge] summary/log configuration' '
134134 test_cmp expected actual2
135135'
136136
137- test_expect_success ' setup: clear [merge] configuration' '
138- test_might_fail git config --unset-all merge.log &&
139- test_might_fail git config --unset-all merge.summary
140- '
141-
142137test_expect_success ' setup FETCH_HEAD' '
143138 git checkout master &&
144139 test_tick &&
@@ -248,14 +243,14 @@ test_expect_success 'fmt-merge-msg -m' '
248243 Common #1
249244 EOF
250245
251- test_might_fail git config --unset merge.log &&
252- test_might_fail git config --unset merge.summary &&
246+ test_unconfig merge.log &&
247+ test_unconfig merge.summary &&
253248 git checkout master &&
254249 git fetch "$(pwd)" left &&
255250 git fmt-merge-msg -m "Sync with left" <.git/FETCH_HEAD >actual &&
256251 git fmt-merge-msg --log -m "Sync with left" \
257252 <.git/FETCH_HEAD >actual.log &&
258- git config merge.log true &&
253+ test_config merge.log true &&
259254 git fmt-merge-msg -m "Sync with left" \
260255 <.git/FETCH_HEAD >actual.log-config &&
261256 git fmt-merge-msg --no-log -m "Sync with left" \
@@ -290,29 +285,29 @@ test_expect_success 'setup: expected shortlog for two branches' '
290285'
291286
292287test_expect_success ' shortlog for two branches' '
293- git config merge.log true &&
294- test_might_fail git config --unset-all merge.summary &&
288+ test_config merge.log true &&
289+ test_unconfig merge.summary &&
295290 git checkout master &&
296291 test_tick &&
297292 git fetch . left right &&
298293 git fmt-merge-msg <.git/FETCH_HEAD >actual1 &&
299294
300- test_might_fail git config --unset-all merge.log &&
301- git config merge.summary true &&
295+ test_unconfig merge.log &&
296+ test_config merge.summary true &&
302297 git checkout master &&
303298 test_tick &&
304299 git fetch . left right &&
305300 git fmt-merge-msg <.git/FETCH_HEAD >actual2 &&
306301
307- git config merge.log yes &&
308- test_might_fail git config --unset-all merge.summary &&
302+ test_config merge.log yes &&
303+ test_unconfig merge.summary &&
309304 git checkout master &&
310305 test_tick &&
311306 git fetch . left right &&
312307 git fmt-merge-msg <.git/FETCH_HEAD >actual3 &&
313308
314- test_might_fail git config --unset-all merge.log &&
315- git config merge.summary yes &&
309+ test_unconfig merge.log &&
310+ test_config merge.summary yes &&
316311 git checkout master &&
317312 test_tick &&
318313 git fetch . left right &&
@@ -325,8 +320,8 @@ test_expect_success 'shortlog for two branches' '
325320'
326321
327322test_expect_success ' merge-msg -F' '
328- test_might_fail git config --unset-all merge.log &&
329- git config merge.summary yes &&
323+ test_unconfig merge.log &&
324+ test_config merge.summary yes &&
330325 git checkout master &&
331326 test_tick &&
332327 git fetch . left right &&
@@ -335,8 +330,8 @@ test_expect_success 'merge-msg -F' '
335330'
336331
337332test_expect_success ' merge-msg -F in subdirectory' '
338- test_might_fail git config --unset-all merge.log &&
339- git config merge.summary yes &&
333+ test_unconfig merge.log &&
334+ test_config merge.summary yes &&
340335 git checkout master &&
341336 test_tick &&
342337 git fetch . left right &&
@@ -350,8 +345,8 @@ test_expect_success 'merge-msg -F in subdirectory' '
350345'
351346
352347test_expect_success ' merge-msg with nothing to merge' '
353- test_might_fail git config --unset-all merge.log &&
354- git config merge.summary yes &&
348+ test_unconfig merge.log &&
349+ test_config merge.summary yes &&
355350
356351 >empty &&
357352
@@ -376,8 +371,8 @@ test_expect_success 'merge-msg tag' '
376371 Common #1
377372 EOF
378373
379- test_might_fail git config --unset-all merge.log &&
380- git config merge.summary yes &&
374+ test_unconfig merge.log &&
375+ test_config merge.summary yes &&
381376
382377 git checkout master &&
383378 test_tick &&
@@ -406,8 +401,8 @@ test_expect_success 'merge-msg two tags' '
406401 Common #1
407402 EOF
408403
409- test_might_fail git config --unset-all merge.log &&
410- git config merge.summary yes &&
404+ test_unconfig merge.log &&
405+ test_config merge.summary yes &&
411406
412407 git checkout master &&
413408 test_tick &&
@@ -436,8 +431,8 @@ test_expect_success 'merge-msg tag and branch' '
436431 Common #1
437432 EOF
438433
439- test_might_fail git config --unset-all merge.log &&
440- git config merge.summary yes &&
434+ test_unconfig merge.log &&
435+ test_config merge.summary yes &&
441436
442437 git checkout master &&
443438 test_tick &&
@@ -464,6 +459,8 @@ test_expect_success 'merge-msg lots of commits' '
464459 echo " ..."
465460 } >expected &&
466461
462+ test_config merge.summary yes &&
463+
467464 git checkout master &&
468465 test_tick &&
469466 git fetch . long &&
@@ -472,4 +469,43 @@ test_expect_success 'merge-msg lots of commits' '
472469 test_cmp expected actual
473470'
474471
472+ test_expect_success ' merge-msg with "merging" an annotated tag' '
473+ test_config merge.log true &&
474+
475+ git checkout master^0 &&
476+ git commit --allow-empty -m "One step ahead" &&
477+ git tag -a -m "An annotated one" annote HEAD &&
478+
479+ git checkout master &&
480+ git fetch . annote &&
481+
482+ git fmt-merge-msg <.git/FETCH_HEAD >actual &&
483+ {
484+ cat <<-\EOF
485+ Merge tag ' \' ' annote' \' '
486+
487+ An annotated one
488+
489+ * tag ' \' ' annote' \' ' :
490+ One step ahead
491+ EOF
492+ } >expected &&
493+ test_cmp expected actual &&
494+
495+ test_when_finished "git reset --hard" &&
496+ annote=$(git rev-parse annote) &&
497+ git merge --no-commit $annote &&
498+ {
499+ cat <<-EOF
500+ Merge tag ' \' ' $annote' \' '
501+
502+ An annotated one
503+
504+ * tag ' \' ' $annote' \' ' :
505+ One step ahead
506+ EOF
507+ } >expected &&
508+ test_cmp expected .git/MERGE_MSG
509+ '
510+
475511test_done
0 commit comments