418
418
419
419
echo ' ## Custom template' > template
420
420
421
- clear_config () {
422
- (
423
- git config --unset-all " $1 "
424
- case $? in
425
- 0|5) exit 0 ;;
426
- * ) exit 1 ;;
427
- esac
428
- )
429
- }
430
-
431
421
try_commit () {
432
422
git reset --hard &&
433
423
echo >> negative &&
@@ -443,67 +433,57 @@ try_commit () {
443
433
try_commit_status_combo () {
444
434
445
435
test_expect_success ' commit' '
446
- clear_config commit.status &&
447
436
try_commit "" &&
448
437
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
449
438
'
450
439
451
440
test_expect_success ' commit' '
452
- clear_config commit.status &&
453
441
try_commit "" &&
454
442
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
455
443
'
456
444
457
445
test_expect_success ' commit --status' '
458
- clear_config commit.status &&
459
446
try_commit --status &&
460
447
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
461
448
'
462
449
463
450
test_expect_success ' commit --no-status' '
464
- clear_config commit.status &&
465
451
try_commit --no-status &&
466
452
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
467
453
'
468
454
469
455
test_expect_success ' commit with commit.status = yes' '
470
- clear_config commit.status &&
471
- git config commit.status yes &&
456
+ test_config commit.status yes &&
472
457
try_commit "" &&
473
458
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
474
459
'
475
460
476
461
test_expect_success ' commit with commit.status = no' '
477
- clear_config commit.status &&
478
- git config commit.status no &&
462
+ test_config commit.status no &&
479
463
try_commit "" &&
480
464
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
481
465
'
482
466
483
467
test_expect_success ' commit --status with commit.status = yes' '
484
- clear_config commit.status &&
485
- git config commit.status yes &&
468
+ test_config commit.status yes &&
486
469
try_commit --status &&
487
470
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
488
471
'
489
472
490
473
test_expect_success ' commit --no-status with commit.status = yes' '
491
- clear_config commit.status &&
492
- git config commit.status yes &&
474
+ test_config commit.status yes &&
493
475
try_commit --no-status &&
494
476
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
495
477
'
496
478
497
479
test_expect_success ' commit --status with commit.status = no' '
498
- clear_config commit.status &&
499
- git config commit.status no &&
480
+ test_config commit.status no &&
500
481
try_commit --status &&
501
482
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
502
483
'
503
484
504
485
test_expect_success ' commit --no-status with commit.status = no' '
505
- clear_config commit.status &&
506
- git config commit.status no &&
486
+ test_config commit.status no &&
507
487
try_commit --no-status &&
508
488
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
509
489
'
0 commit comments