Git fork

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>

authored by

Jeff King and committed by
Junio C Hamano
f7e87141 551a3e60

+17 -18
+10 -10
t/t1300-repo-config.sh
··· 461 test_cmp expect .git/config 462 ' 463 464 - test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' ' 465 test_must_fail git config --file non-existing-config -l 466 ' 467 ··· 495 496 ' 497 498 - test_expect_success 'refer config from subdirectory via GIT_CONFIG' ' 499 ( 500 cd x && 501 - GIT_CONFIG=../other-config git config --get ein.bahn >actual && 502 test_cmp expect actual 503 ) 504 ' ··· 510 park = ausweis 511 EOF 512 513 - test_expect_success '--set in alternative GIT_CONFIG' ' 514 - GIT_CONFIG=other-config git config anwohner.park ausweis && 515 test_cmp expect other-config 516 ' 517 ··· 942 943 test_expect_success SYMLINKS 'symlinked configuration' ' 944 ln -s notyet myconfig && 945 - GIT_CONFIG=myconfig git config test.frotz nitfol && 946 test -h myconfig && 947 test -f notyet && 948 - test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol && 949 - GIT_CONFIG=myconfig git config test.xyzzy rezrov && 950 test -h myconfig && 951 test -f notyet && 952 cat >expect <<-\EOF && ··· 954 rezrov 955 EOF 956 { 957 - GIT_CONFIG=notyet git config test.frotz && 958 - GIT_CONFIG=notyet git config test.xyzzy 959 } >actual && 960 test_cmp expect actual 961 '
··· 461 test_cmp expect .git/config 462 ' 463 464 + test_expect_success 'alternative --file (non-existing file should fail)' ' 465 test_must_fail git config --file non-existing-config -l 466 ' 467 ··· 495 496 ' 497 498 + test_expect_success 'refer config from subdirectory via --file' ' 499 ( 500 cd x && 501 + git config --file=../other-config --get ein.bahn >actual && 502 test_cmp expect actual 503 ) 504 ' ··· 510 park = ausweis 511 EOF 512 513 + test_expect_success '--set in alternative file' ' 514 + git config --file=other-config anwohner.park ausweis && 515 test_cmp expect other-config 516 ' 517 ··· 942 943 test_expect_success SYMLINKS 'symlinked configuration' ' 944 ln -s notyet myconfig && 945 + git config --file=myconfig test.frotz nitfol && 946 test -h myconfig && 947 test -f notyet && 948 + test "z$(git config --file=notyet test.frotz)" = znitfol && 949 + git config --file=myconfig test.xyzzy rezrov && 950 test -h myconfig && 951 test -f notyet && 952 cat >expect <<-\EOF && ··· 954 rezrov 955 EOF 956 { 957 + git config --file=notyet test.frotz && 958 + git config --file=notyet test.xyzzy 959 } >actual && 960 test_cmp expect actual 961 '
+1 -1
t/t1302-repo-version.sh
··· 19 20 test_create_repo "test" && 21 test_create_repo "test2" && 22 - GIT_CONFIG=test2/.git/config git config core.repositoryformatversion 99 23 ' 24 25 test_expect_success 'gitdir selection on normal repos' '
··· 19 20 test_create_repo "test" && 21 test_create_repo "test2" && 22 + git config --file=test2/.git/config core.repositoryformatversion 99 23 ' 24 25 test_expect_success 'gitdir selection on normal repos' '
+2 -3
t/t7400-submodule-basic.sh
··· 249 ' 250 251 test_expect_success 'setup - add an example entry to .gitmodules' ' 252 - GIT_CONFIG=.gitmodules \ 253 - git config submodule.example.url git://example.com/init.git 254 ' 255 256 test_expect_success 'status should fail for unmapped paths' ' ··· 264 path = init 265 EOF 266 267 - GIT_CONFIG=.gitmodules git config submodule.example.path init && 268 269 test_cmp expect .gitmodules 270 '
··· 249 ' 250 251 test_expect_success 'setup - add an example entry to .gitmodules' ' 252 + git config --file=.gitmodules submodule.example.url git://example.com/init.git 253 ' 254 255 test_expect_success 'status should fail for unmapped paths' ' ··· 263 path = init 264 EOF 265 266 + git config --file=.gitmodules submodule.example.path init && 267 268 test_cmp expect .gitmodules 269 '
+1 -1
t/t9130-git-svn-authors-file.sh
··· 67 ' 68 69 tmp_config_get () { 70 - GIT_CONFIG=.git/svn/.metadata git config --get "$1" 71 } 72 73 test_expect_success 'failure happened without negative side effects' '
··· 67 ' 68 69 tmp_config_get () { 70 + git config --file=.git/svn/.metadata --get "$1" 71 } 72 73 test_expect_success 'failure happened without negative side effects' '
+3 -3
t/t9154-git-svn-fancy-glob.sh
··· 22 " 23 24 test_expect_success 'add gre branch' " 25 - GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev && 26 git config svn-remote.svn.branches 'branches/{red,gre}:refs/remotes/*' && 27 git svn fetch && 28 git rev-parse refs/remotes/red && ··· 31 " 32 33 test_expect_success 'add green branch' " 34 - GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev && 35 git config svn-remote.svn.branches 'branches/{red,green}:refs/remotes/*' && 36 git svn fetch && 37 git rev-parse refs/remotes/red && ··· 40 " 41 42 test_expect_success 'add all branches' " 43 - GIT_CONFIG=.git/svn/.metadata git config --unset svn-remote.svn.branches-maxRev && 44 git config svn-remote.svn.branches 'branches/*:refs/remotes/*' && 45 git svn fetch && 46 git rev-parse refs/remotes/red &&
··· 22 " 23 24 test_expect_success 'add gre branch' " 25 + git config --file=.git/svn/.metadata --unset svn-remote.svn.branches-maxRev && 26 git config svn-remote.svn.branches 'branches/{red,gre}:refs/remotes/*' && 27 git svn fetch && 28 git rev-parse refs/remotes/red && ··· 31 " 32 33 test_expect_success 'add green branch' " 34 + git config --file=.git/svn/.metadata --unset svn-remote.svn.branches-maxRev && 35 git config svn-remote.svn.branches 'branches/{red,green}:refs/remotes/*' && 36 git svn fetch && 37 git rev-parse refs/remotes/red && ··· 40 " 41 42 test_expect_success 'add all branches' " 43 + git config --file=.git/svn/.metadata --unset svn-remote.svn.branches-maxRev && 44 git config svn-remote.svn.branches 'branches/*:refs/remotes/*' && 45 git svn fetch && 46 git rev-parse refs/remotes/red &&