Skip to content

Commit e023a31

Browse files
ydroneaudgitster
authored andcommitted
t7502: remove clear_config
Using test_config ensure the configuration variable are removed at the end of the test, there's no need to remove variable at the beginning of the test. Signed-off-by: Yann Droneaud <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 464be63 commit e023a31

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

t/t7502-commit.sh

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,6 @@ EOF
418418

419419
echo '## Custom template' >template
420420

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-
431421
try_commit () {
432422
git reset --hard &&
433423
echo >>negative &&
@@ -443,67 +433,57 @@ try_commit () {
443433
try_commit_status_combo () {
444434

445435
test_expect_success 'commit' '
446-
clear_config commit.status &&
447436
try_commit "" &&
448437
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
449438
'
450439

451440
test_expect_success 'commit' '
452-
clear_config commit.status &&
453441
try_commit "" &&
454442
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
455443
'
456444

457445
test_expect_success 'commit --status' '
458-
clear_config commit.status &&
459446
try_commit --status &&
460447
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
461448
'
462449

463450
test_expect_success 'commit --no-status' '
464-
clear_config commit.status &&
465451
try_commit --no-status &&
466452
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
467453
'
468454

469455
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 &&
472457
try_commit "" &&
473458
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
474459
'
475460

476461
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 &&
479463
try_commit "" &&
480464
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
481465
'
482466

483467
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 &&
486469
try_commit --status &&
487470
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
488471
'
489472

490473
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 &&
493475
try_commit --no-status &&
494476
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
495477
'
496478

497479
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 &&
500481
try_commit --status &&
501482
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
502483
'
503484

504485
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 &&
507487
try_commit --no-status &&
508488
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
509489
'

0 commit comments

Comments
 (0)