diff options
author | Jeff King <peff@peff.net> | 2014-03-20 19:17:01 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-21 14:26:55 -0700 |
commit | f7e87141011fc55f8267ea76d3cc016ee87f9053 (patch) | |
tree | e6127793ab08403ad771f7e7e58a775f2f434d55 /t/t1300-repo-config.sh | |
parent | 551a3e60d1cb9dca37a3a789cf1a4b94074ce6c5 (diff) | |
download | git-f7e87141011fc55f8267ea76d3cc016ee87f9053.tar.gz |
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>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-x | t/t1300-repo-config.sh | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index e355aa1c97..85c6637008 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -461,7 +461,7 @@ test_expect_success 'new variable inserts into proper section' ' test_cmp expect .git/config ' -test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' ' +test_expect_success 'alternative --file (non-existing file should fail)' ' test_must_fail git config --file non-existing-config -l ' @@ -495,10 +495,10 @@ test_expect_success 'refer config from subdirectory' ' ' -test_expect_success 'refer config from subdirectory via GIT_CONFIG' ' +test_expect_success 'refer config from subdirectory via --file' ' ( cd x && - GIT_CONFIG=../other-config git config --get ein.bahn >actual && + git config --file=../other-config --get ein.bahn >actual && test_cmp expect actual ) ' @@ -510,8 +510,8 @@ cat > expect << EOF park = ausweis EOF -test_expect_success '--set in alternative GIT_CONFIG' ' - GIT_CONFIG=other-config git config anwohner.park ausweis && +test_expect_success '--set in alternative file' ' + git config --file=other-config anwohner.park ausweis && test_cmp expect other-config ' @@ -942,11 +942,11 @@ test_expect_success 'inner whitespace kept verbatim' ' test_expect_success SYMLINKS 'symlinked configuration' ' ln -s notyet myconfig && - GIT_CONFIG=myconfig git config test.frotz nitfol && + git config --file=myconfig test.frotz nitfol && test -h myconfig && test -f notyet && - test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol && - GIT_CONFIG=myconfig git config test.xyzzy rezrov && + test "z$(git config --file=notyet test.frotz)" = znitfol && + git config --file=myconfig test.xyzzy rezrov && test -h myconfig && test -f notyet && cat >expect <<-\EOF && @@ -954,8 +954,8 @@ test_expect_success SYMLINKS 'symlinked configuration' ' rezrov EOF { - GIT_CONFIG=notyet git config test.frotz && - GIT_CONFIG=notyet git config test.xyzzy + git config --file=notyet test.frotz && + git config --file=notyet test.xyzzy } >actual && test_cmp expect actual ' |