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