t: prefer "git config --file" to GIT_CONFIG

Doing:

  GIT_CONFIG=foo git config ...

is equivalent to:

  git config --file=foo ...

The latter is easier to read and slightly less error-prone,
because of issues with one-shot variables and shell
functions (e.g., you cannot use the former with
test_must_fail).

Note that we explicitly leave one case in t1300 which checks
the same operation on both GIT_CONFIG and "git config
--file". They are equivalent in the code these days, but
this will make sure it remains so.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2014-03-20 19:17:01 -04:00
committed by Junio C Hamano
parent 551a3e60d1
commit f7e8714101
5 changed files with 17 additions and 18 deletions

View File

@ -67,7 +67,7 @@ test_expect_success 'fetch fails on ee' '
'
tmp_config_get () {
GIT_CONFIG=.git/svn/.metadata git config --get "$1"
git config --file=.git/svn/.metadata --get "$1"
}
test_expect_success 'failure happened without negative side effects' '