]> granicus.if.org Git - git/commitdiff
t7502: use test_config to set/unset git config variables
authorYann Droneaud <ydroneaud@opteya.com>
Sun, 24 Mar 2013 21:06:10 +0000 (22:06 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Mar 2013 15:50:54 +0000 (08:50 -0700)
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>
t/t7502-commit.sh

index cbd7a45927eb2d4b04649f21f82192091782ce90..3e956506c0abf0d082c7ee8c4fd0559f4712efd0 100755 (executable)
@@ -171,10 +171,9 @@ test_expect_success 'verbose' '
 
 test_expect_success 'verbose respects diff config' '
 
-       git config color.diff always &&
+       test_config color.diff always &&
        git status -v >actual &&
-       grep "\[1mdiff --git" actual &&
-       git config --unset color.diff
+       grep "\[1mdiff --git" actual
 '
 
 test_expect_success 'cleanup commit messages (verbatim option,-t)' '
@@ -518,8 +517,7 @@ use_template="-t template"
 try_commit_status_combo
 
 test_expect_success 'commit --status with custom comment character' '
-       test_when_finished "git config --unset core.commentchar" &&
-       git config core.commentchar ";" &&
+       test_config core.commentchar ";" &&
        try_commit --status &&
        test_i18ngrep "^; Changes to be committed:" .git/COMMIT_EDITMSG
 '