t0001: use test_config_global
authorJeff King <peff@peff.net>
Thu, 20 Mar 2014 23:18:12 +0000 (19:18 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Mar 2014 21:28:03 +0000 (14:28 -0700)
We hand-set several config options using :

git config -f $HOME/.gitconfig ...

Instead, we can use "test_config_global". Not only is this
more readable, but it cleans up for us so that subsequent
tests aren't polluted by our settings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0001-init.sh
index fdcf4b3ba5f2c544b0550168aca48894e8ef37f7..9515da3024ebfee7c3af1d87dcd09a4fe2836dc0 100755 (executable)
@@ -211,9 +211,8 @@ test_expect_success 'init with --template (blank)' '
 test_expect_success 'init with init.templatedir set' '
        mkdir templatedir-source &&
        echo Content >templatedir-source/file &&
+       test_config_global init.templatedir "${HOME}/templatedir-source" &&
        (
-               test_config="${HOME}/.gitconfig" &&
-               git config -f "$test_config"  init.templatedir "${HOME}/templatedir-source" &&
                mkdir templatedir-set &&
                cd templatedir-set &&
                sane_unset GIT_TEMPLATE_DIR &&
@@ -225,10 +224,9 @@ test_expect_success 'init with init.templatedir set' '
 '
 
 test_expect_success 'init --bare/--shared overrides system/global config' '
+       test_config_global core.bare false &&
+       test_config_global core.sharedRepository 0640 &&
        (
-               test_config="$HOME"/.gitconfig &&
-               git config -f "$test_config" core.bare false &&
-               git config -f "$test_config" core.sharedRepository 0640 &&
                mkdir init-bare-shared-override &&
                cd init-bare-shared-override &&
                git init --bare --shared=0666
@@ -239,9 +237,8 @@ test_expect_success 'init --bare/--shared overrides system/global config' '
 '
 
 test_expect_success 'init honors global core.sharedRepository' '
+       test_config_global core.sharedRepository 0666 &&
        (
-               test_config="$HOME"/.gitconfig &&
-               git config -f "$test_config" core.sharedRepository 0666 &&
                mkdir shared-honor-global &&
                cd shared-honor-global &&
                git init