t7508: use test_config 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. 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 c63659dd9638d756a07de13230703406a59b81a0
1 file changed +16 -30
t/t7508-status.sh
+16 -30
@@ -130,8 +130,7 @@ cat >expect <<\EOF
130 EOF
131
132 test_expect_success 'status (advice.statusHints false)' '
133 - test_when_finished "git config --unset advice.statusHints" &&
134 - git config advice.statusHints false &&
133 + test_config advice.statusHints false &&
134 git status >output &&
135 test_i18ncmp expect output
136
@@ -331,8 +330,7 @@ test_expect_success 'status -uno' '
330 '
331
332 test_expect_success 'status (status.showUntrackedFiles no)' '
334 - git config status.showuntrackedfiles no
335 - test_when_finished "git config --unset status.showuntrackedfiles" &&
333 + test_config status.showuntrackedfiles no &&
334 git status >output &&
335 test_i18ncmp expect output
336 '
@@ -347,12 +345,11 @@ cat >expect <<EOF
345 #
346 # Untracked files not listed
347 EOF
350 -git config advice.statusHints false
348 test_expect_success 'status -uno (advice.statusHints false)' '
349 + test_config advice.statusHints false &&
350 git status -uno >output &&
351 test_i18ncmp expect output
352 '
355 -git config --unset advice.statusHints
353
354 cat >expect << EOF
355 M dir1/modified
@@ -399,8 +396,7 @@ test_expect_success 'status -unormal' '
396 '
397
398 test_expect_success 'status (status.showUntrackedFiles normal)' '
402 - git config status.showuntrackedfiles normal
403 - test_when_finished "git config --unset status.showuntrackedfiles" &&
399 + test_config status.showuntrackedfiles normal
400 git status >output &&
401 test_i18ncmp expect output
402 '
@@ -458,8 +454,7 @@ test_expect_success 'status -uall' '
454 '
455
456 test_expect_success 'status (status.showUntrackedFiles all)' '
461 - git config status.showuntrackedfiles all
462 - test_when_finished "git config --unset status.showuntrackedfiles" &&
457 + test_config status.showuntrackedfiles all
458 git status >output &&
459 test_i18ncmp expect output
460 '
@@ -484,10 +479,9 @@ test_expect_success 'status -s -uall' '
479 test_cmp expect output
480 '
481 test_expect_success 'status -s (status.showUntrackedFiles all)' '
487 - git config status.showuntrackedfiles all
482 + test_config status.showuntrackedfiles all &&
483 git status -s >output &&
484 rm -rf dir3 &&
490 - git config --unset status.showuntrackedfiles &&
485 test_cmp expect output
486 '
487
@@ -587,15 +581,13 @@ cat >expect <<\EOF
581 EOF
582
583 test_expect_success 'status with color.ui' '
590 - git config color.ui always &&
591 - test_when_finished "git config --unset color.ui" &&
584 + test_config color.ui always &&
585 git status | test_decode_color >output &&
586 test_i18ncmp expect output
587 '
588
589 test_expect_success 'status with color.status' '
597 - git config color.status always &&
598 - test_when_finished "git config --unset color.status" &&
590 + test_config color.status always &&
591 git status | test_decode_color >output &&
592 test_i18ncmp expect output
593 '
@@ -719,8 +711,7 @@ EOF
711
712 test_expect_success 'status without relative paths' '
713
722 - git config status.relativePaths false &&
723 - test_when_finished "git config --unset status.relativePaths" &&
714 + test_config status.relativePaths false &&
715 (cd dir1 && git status) >output &&
716 test_i18ncmp expect output
717
@@ -739,8 +730,7 @@ EOF
730
731 test_expect_success 'status -s without relative paths' '
732
742 - git config status.relativePaths false &&
743 - test_when_finished "git config --unset status.relativePaths" &&
733 + test_config status.relativePaths false &&
734 (cd dir1 && git status -s) >output &&
735 test_cmp expect output
736
@@ -1037,15 +1027,14 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
1027 '
1028
1029 test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
1040 - git config diff.ignoreSubmodules dirty &&
1030 + test_config diff.ignoreSubmodules dirty &&
1031 git status >output &&
1032 test_i18ncmp expect output &&
1033 git config --add -f .gitmodules submodule.subname.ignore untracked &&
1034 git config --add -f .gitmodules submodule.subname.path sm &&
1035 git status >output &&
1036 test_i18ncmp expect output &&
1047 - git config -f .gitmodules --remove-section submodule.subname &&
1048 - git config --unset diff.ignoreSubmodules
1037 + git config -f .gitmodules --remove-section submodule.subname
1038 '
1039
1040 test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
@@ -1065,15 +1054,14 @@ test_expect_success '--ignore-submodules=dirty suppresses submodules with untrac
1054 '
1055
1056 test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
1068 - git config diff.ignoreSubmodules dirty &&
1057 + test_config diff.ignoreSubmodules dirty &&
1058 git status >output &&
1059 ! test -s actual &&
1060 git config --add -f .gitmodules submodule.subname.ignore dirty &&
1061 git config --add -f .gitmodules submodule.subname.path sm &&
1062 git status >output &&
1063 test_i18ncmp expect output &&
1075 - git config -f .gitmodules --remove-section submodule.subname &&
1076 - git config --unset diff.ignoreSubmodules
1064 + git config -f .gitmodules --remove-section submodule.subname
1065 '
1066
1067 test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
@@ -1290,15 +1278,13 @@ cat > expect << EOF
1278 EOF
1279
1280 test_expect_success "status (core.commentchar with submodule summary)" '
1293 - test_when_finished "git config --unset core.commentchar" &&
1294 - git config core.commentchar ";" &&
1281 + test_config core.commentchar ";" &&
1282 git status >output &&
1283 test_i18ncmp expect output
1284 '
1285
1286 test_expect_success "status (core.commentchar with two chars with submodule summary)" '
1300 - test_when_finished "git config --unset core.commentchar" &&
1301 - git config core.commentchar ";;" &&
1287 + test_config core.commentchar ";;" &&
1288 git status >output &&
1289 test_i18ncmp expect output
1290 '