t4202: use test_config/test_unconfig to set/unset git config variables
Instead of using construct such as: test_when_finished "git config --unset <key>" git config <key> <value> uses test_config <key> <value> The latter takes care of removing <key> at the end of the test. Additionally, instead of git config <key> "" or git config --unset <key> uses test_unconfig <key> The latter doesn't failed if <key> is not defined. Tests are modified to assume correct (default) configuration at entry, and to reset the modified configuration variables at the end. Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Yann Droneaud committed
Mar 24, 2013 at 22:06 UTC
90e76b7029d02314b6f8f8470788874fc44fa621
1 file changed
+8
-20
t/t4202-log.sh
+8
-20
@@ -419,8 +419,6 @@ test_expect_success 'log --graph with merge' '
419
'
420
421
test_expect_success 'log.decorate configuration' '
422
- test_might_fail git config --unset-all log.decorate &&
423
-
422
git log --oneline >expect.none &&
423
git log --oneline --decorate >expect.short &&
424
git log --oneline --decorate=full >expect.full &&
@@ -429,8 +427,7 @@ test_expect_success 'log.decorate configuration' '
427
git log --oneline >actual &&
428
test_cmp expect.short actual &&
429
432
- git config --unset-all log.decorate &&
433
- git config log.decorate true &&
430
+ test_config log.decorate true &&
431
git log --oneline >actual &&
432
test_cmp expect.short actual &&
433
git log --oneline --decorate=full >actual &&
@@ -438,8 +435,7 @@ test_expect_success 'log.decorate configuration' '
435
git log --oneline --decorate=no >actual &&
436
test_cmp expect.none actual &&
437
441
- git config --unset-all log.decorate &&
442
- git config log.decorate no &&
438
+ test_config log.decorate no &&
439
git log --oneline >actual &&
440
test_cmp expect.none actual &&
441
git log --oneline --decorate >actual &&
@@ -447,8 +443,7 @@ test_expect_success 'log.decorate configuration' '
443
git log --oneline --decorate=full >actual &&
444
test_cmp expect.full actual &&
445
450
- git config --unset-all log.decorate &&
451
- git config log.decorate 1 &&
446
+ test_config log.decorate 1 &&
447
git log --oneline >actual &&
448
test_cmp expect.short actual &&
449
git log --oneline --decorate=full >actual &&
@@ -456,8 +451,7 @@ test_expect_success 'log.decorate configuration' '
451
git log --oneline --decorate=no >actual &&
452
test_cmp expect.none actual &&
453
459
- git config --unset-all log.decorate &&
460
- git config log.decorate short &&
454
+ test_config log.decorate short &&
455
git log --oneline >actual &&
456
test_cmp expect.short actual &&
457
git log --oneline --no-decorate >actual &&
@@ -465,8 +459,7 @@ test_expect_success 'log.decorate configuration' '
459
git log --oneline --decorate=full >actual &&
460
test_cmp expect.full actual &&
461
468
- git config --unset-all log.decorate &&
469
- git config log.decorate full &&
462
+ test_config log.decorate full &&
463
git log --oneline >actual &&
464
test_cmp expect.full actual &&
465
git log --oneline --no-decorate >actual &&
@@ -474,16 +467,15 @@ test_expect_success 'log.decorate configuration' '
467
git log --oneline --decorate >actual &&
468
test_cmp expect.short actual
469
477
- git config --unset-all log.decorate &&
470
+ test_unconfig log.decorate &&
471
git log --pretty=raw >expect.raw &&
479
- git config log.decorate full &&
472
+ test_config log.decorate full &&
473
git log --pretty=raw >actual &&
474
test_cmp expect.raw actual
475
476
'
477
478
test_expect_success 'reflog is expected format' '
486
- test_might_fail git config --remove-section log &&
479
git log -g --abbrev-commit --pretty=oneline >expect &&
480
git reflog >actual &&
481
test_cmp expect actual
@@ -496,10 +488,6 @@ test_expect_success 'whatchanged is expected format' '
488
'
489
490
test_expect_success 'log.abbrevCommit configuration' '
499
- test_when_finished "git config --unset log.abbrevCommit" &&
500
-
501
- test_might_fail git config --unset log.abbrevCommit &&
502
-
491
git log --abbrev-commit >expect.log.abbrev &&
492
git log --no-abbrev-commit >expect.log.full &&
493
git log --pretty=raw >expect.log.raw &&
@@ -508,7 +496,7 @@ test_expect_success 'log.abbrevCommit configuration' '
496
git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
497
git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
498
511
- git config log.abbrevCommit true &&
499
+ test_config log.abbrevCommit true &&
500
501
git log >actual &&
502
test_cmp expect.log.abbrev actual &&