@@ -56,7 +56,8 @@ create_merge_msgs () {
56
56
echo &&
57
57
git log --no-merges ^HEAD c2 c3
58
58
} > squash.1-5-9 &&
59
- echo > msg.nolog &&
59
+ : > msg.nologff &&
60
+ echo > msg.nolognoff &&
60
61
{
61
62
echo " * tag 'c3':" &&
62
63
echo " commit 3" &&
@@ -244,8 +245,7 @@ test_expect_success 'merges with --ff-only' '
244
245
test_expect_success ' merges with merge.ff=only' '
245
246
git reset --hard c1 &&
246
247
test_tick &&
247
- test_when_finished "git config --unset merge.ff" &&
248
- git config merge.ff only &&
248
+ test_config merge.ff "only" &&
249
249
test_must_fail git merge c2 &&
250
250
test_must_fail git merge c3 &&
251
251
test_must_fail git merge c2 c3 &&
@@ -336,7 +336,7 @@ test_debug 'git log --graph --decorate --oneline --all'
336
336
337
337
test_expect_success ' merge c1 with c2 (no-commit in config)' '
338
338
git reset --hard c1 &&
339
- git config branch.master.mergeoptions "--no-commit" &&
339
+ test_config branch.master.mergeoptions "--no-commit" &&
340
340
git merge c2 &&
341
341
verify_merge file result.1-5 &&
342
342
verify_head $c1 &&
@@ -346,12 +346,11 @@ test_expect_success 'merge c1 with c2 (no-commit in config)' '
346
346
test_debug ' git log --graph --decorate --oneline --all'
347
347
348
348
test_expect_success ' merge c1 with c2 (log in config)' '
349
- git config branch.master.mergeoptions "" &&
350
349
git reset --hard c1 &&
351
350
git merge --log c2 &&
352
351
git show -s --pretty=tformat:%s%n%b >expect &&
353
352
354
- git config branch.master.mergeoptions --log &&
353
+ test_config branch.master.mergeoptions " --log" &&
355
354
git reset --hard c1 &&
356
355
git merge c2 &&
357
356
git show -s --pretty=tformat:%s%n%b >actual &&
@@ -360,17 +359,12 @@ test_expect_success 'merge c1 with c2 (log in config)' '
360
359
'
361
360
362
361
test_expect_success ' merge c1 with c2 (log in config gets overridden)' '
363
- test_when_finished "git config --remove-section branch.master" &&
364
- test_when_finished "git config --remove-section merge" &&
365
- test_might_fail git config --remove-section branch.master &&
366
- test_might_fail git config --remove-section merge &&
367
-
368
362
git reset --hard c1 &&
369
363
git merge c2 &&
370
364
git show -s --pretty=tformat:%s%n%b >expect &&
371
365
372
- git config branch.master.mergeoptions "--no-log" &&
373
- git config merge.log true &&
366
+ test_config branch.master.mergeoptions "--no-log" &&
367
+ test_config merge.log " true" &&
374
368
git reset --hard c1 &&
375
369
git merge c2 &&
376
370
git show -s --pretty=tformat:%s%n%b >actual &&
@@ -380,7 +374,7 @@ test_expect_success 'merge c1 with c2 (log in config gets overridden)' '
380
374
381
375
test_expect_success ' merge c1 with c2 (squash in config)' '
382
376
git reset --hard c1 &&
383
- git config branch.master.mergeoptions "--squash" &&
377
+ test_config branch.master.mergeoptions "--squash" &&
384
378
git merge c2 &&
385
379
verify_merge file result.1-5 &&
386
380
verify_head $c1 &&
@@ -392,7 +386,7 @@ test_debug 'git log --graph --decorate --oneline --all'
392
386
393
387
test_expect_success ' override config option -n with --summary' '
394
388
git reset --hard c1 &&
395
- git config branch.master.mergeoptions "-n" &&
389
+ test_config branch.master.mergeoptions "-n" &&
396
390
test_tick &&
397
391
git merge --summary c2 >diffstat.txt &&
398
392
verify_merge file result.1-5 msg.1-5 &&
@@ -406,7 +400,7 @@ test_expect_success 'override config option -n with --summary' '
406
400
407
401
test_expect_success ' override config option -n with --stat' '
408
402
git reset --hard c1 &&
409
- git config branch.master.mergeoptions "-n" &&
403
+ test_config branch.master.mergeoptions "-n" &&
410
404
test_tick &&
411
405
git merge --stat c2 >diffstat.txt &&
412
406
verify_merge file result.1-5 msg.1-5 &&
@@ -422,7 +416,7 @@ test_debug 'git log --graph --decorate --oneline --all'
422
416
423
417
test_expect_success ' override config option --stat' '
424
418
git reset --hard c1 &&
425
- git config branch.master.mergeoptions "--stat" &&
419
+ test_config branch.master.mergeoptions "--stat" &&
426
420
test_tick &&
427
421
git merge -n c2 >diffstat.txt &&
428
422
verify_merge file result.1-5 msg.1-5 &&
@@ -438,7 +432,7 @@ test_debug 'git log --graph --decorate --oneline --all'
438
432
439
433
test_expect_success ' merge c1 with c2 (override --no-commit)' '
440
434
git reset --hard c1 &&
441
- git config branch.master.mergeoptions "--no-commit" &&
435
+ test_config branch.master.mergeoptions "--no-commit" &&
442
436
test_tick &&
443
437
git merge --commit c2 &&
444
438
verify_merge file result.1-5 msg.1-5 &&
@@ -449,7 +443,7 @@ test_debug 'git log --graph --decorate --oneline --all'
449
443
450
444
test_expect_success ' merge c1 with c2 (override --squash)' '
451
445
git reset --hard c1 &&
452
- git config branch.master.mergeoptions "--squash" &&
446
+ test_config branch.master.mergeoptions "--squash" &&
453
447
test_tick &&
454
448
git merge --no-squash c2 &&
455
449
verify_merge file result.1-5 msg.1-5 &&
@@ -460,7 +454,6 @@ test_debug 'git log --graph --decorate --oneline --all'
460
454
461
455
test_expect_success ' merge c0 with c1 (no-ff)' '
462
456
git reset --hard c0 &&
463
- git config branch.master.mergeoptions "" &&
464
457
test_tick &&
465
458
git merge --no-ff c1 &&
466
459
verify_merge file result.1 &&
@@ -471,33 +464,29 @@ test_debug 'git log --graph --decorate --oneline --all'
471
464
472
465
test_expect_success ' merge c0 with c1 (merge.ff=false)' '
473
466
git reset --hard c0 &&
474
- git config merge.ff false &&
467
+ test_config merge.ff " false" &&
475
468
test_tick &&
476
469
git merge c1 &&
477
- git config --remove-section merge &&
478
470
verify_merge file result.1 &&
479
471
verify_parents $c0 $c1
480
472
'
481
473
test_debug ' git log --graph --decorate --oneline --all'
482
474
483
475
test_expect_success ' combine branch.master.mergeoptions with merge.ff' '
484
476
git reset --hard c0 &&
485
- git config branch.master.mergeoptions --ff &&
486
- git config merge.ff false &&
477
+ test_config branch.master.mergeoptions " --ff" &&
478
+ test_config merge.ff " false" &&
487
479
test_tick &&
488
480
git merge c1 &&
489
- git config --remove-section "branch.master" &&
490
- git config --remove-section "merge" &&
491
481
verify_merge file result.1 &&
492
482
verify_parents "$c0"
493
483
'
494
484
495
485
test_expect_success ' tolerate unknown values for merge.ff' '
496
486
git reset --hard c0 &&
497
- git config merge.ff something-new &&
487
+ test_config merge.ff " something-new" &&
498
488
test_tick &&
499
489
git merge c1 2>message &&
500
- git config --remove-section "merge" &&
501
490
verify_head "$c1" &&
502
491
test_cmp empty message
503
492
'
@@ -515,7 +504,7 @@ test_expect_success 'combining --ff-only and --no-ff is refused' '
515
504
516
505
test_expect_success ' merge c0 with c1 (ff overrides no-ff)' '
517
506
git reset --hard c0 &&
518
- git config branch.master.mergeoptions "--no-ff" &&
507
+ test_config branch.master.mergeoptions "--no-ff" &&
519
508
git merge --ff c1 &&
520
509
verify_merge file result.1 &&
521
510
verify_head $c1
@@ -525,14 +514,20 @@ test_expect_success 'merge log message' '
525
514
git reset --hard c0 &&
526
515
git merge --no-log c2 &&
527
516
git show -s --pretty=format:%b HEAD >msg.act &&
528
- test_cmp msg.nolog msg.act &&
517
+ test_cmp msg.nologff msg.act &&
518
+
519
+ git reset --hard c0 &&
520
+ test_config branch.master.mergeoptions "--no-ff" &&
521
+ git merge --no-log c2 &&
522
+ git show -s --pretty=format:%b HEAD >msg.act &&
523
+ test_cmp msg.nolognoff msg.act &&
529
524
530
525
git merge --log c3 &&
531
526
git show -s --pretty=format:%b HEAD >msg.act &&
532
527
test_cmp msg.log msg.act &&
533
528
534
529
git reset --hard HEAD^ &&
535
- git config merge.log yes &&
530
+ test_config merge.log " yes" &&
536
531
git merge c3 &&
537
532
git show -s --pretty=format:%b HEAD >msg.act &&
538
533
test_cmp msg.log msg.act
@@ -542,7 +537,6 @@ test_debug 'git log --graph --decorate --oneline --all'
542
537
543
538
test_expect_success ' merge c1 with c0, c2, c0, and c1' '
544
539
git reset --hard c1 &&
545
- git config branch.master.mergeoptions "" &&
546
540
test_tick &&
547
541
git merge c0 c2 c0 c1 &&
548
542
verify_merge file result.1-5 &&
@@ -553,7 +547,6 @@ test_debug 'git log --graph --decorate --oneline --all'
553
547
554
548
test_expect_success ' merge c1 with c0, c2, c0, and c1' '
555
549
git reset --hard c1 &&
556
- git config branch.master.mergeoptions "" &&
557
550
test_tick &&
558
551
git merge c0 c2 c0 c1 &&
559
552
verify_merge file result.1-5 &&
@@ -564,7 +557,6 @@ test_debug 'git log --graph --decorate --oneline --all'
564
557
565
558
test_expect_success ' merge c1 with c1 and c2' '
566
559
git reset --hard c1 &&
567
- git config branch.master.mergeoptions "" &&
568
560
test_tick &&
569
561
git merge c1 c2 &&
570
562
verify_merge file result.1-5 &&
0 commit comments