Skip to content

Commit

Permalink
t7502: remove clear_config
Browse files Browse the repository at this point in the history
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 <ydroneaud@opteya.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Yann Droneaud authored and Junio C Hamano committed Mar 25, 2013
1 parent 464be63 commit e023a31
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions t/t7502-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,6 @@ EOF

echo '## Custom template' >template

clear_config () {
(
git config --unset-all "$1"
case $? in
0|5) exit 0 ;;
*) exit 1 ;;
esac
)
}

try_commit () {
git reset --hard &&
echo >>negative &&
Expand All @@ -443,67 +433,57 @@ try_commit () {
try_commit_status_combo () {

test_expect_success 'commit' '
clear_config commit.status &&
try_commit "" &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit' '
clear_config commit.status &&
try_commit "" &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit --status' '
clear_config commit.status &&
try_commit --status &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit --no-status' '
clear_config commit.status &&
try_commit --no-status &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit with commit.status = yes' '
clear_config commit.status &&
git config commit.status yes &&
test_config commit.status yes &&
try_commit "" &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit with commit.status = no' '
clear_config commit.status &&
git config commit.status no &&
test_config commit.status no &&
try_commit "" &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit --status with commit.status = yes' '
clear_config commit.status &&
git config commit.status yes &&
test_config commit.status yes &&
try_commit --status &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit --no-status with commit.status = yes' '
clear_config commit.status &&
git config commit.status yes &&
test_config commit.status yes &&
try_commit --no-status &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit --status with commit.status = no' '
clear_config commit.status &&
git config commit.status no &&
test_config commit.status no &&
try_commit --status &&
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'

test_expect_success 'commit --no-status with commit.status = no' '
clear_config commit.status &&
git config commit.status no &&
test_config commit.status no &&
try_commit --no-status &&
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
Expand Down

0 comments on commit e023a31

Please sign in to comment.