t: drop useless sane_unset GIT_* calls

Several test scripts manually unset GIT_CONFIG and other GIT_* variables. These are generally taken care of for us by test-lib.sh already. Unsetting these is not only useless, but can be confusing to a reader, who may wonder why some tests in a script unset them and others do not (t0001 is particularly guilty of this inconsistency, probably because many of its tests predate the test-lib.sh environment-cleansing). Note that we cannot always get rid of such unsetting. For example, t9130 can drop the GIT_CONFIG unset, but not the GIT_DIR one, because lib-git-svn.sh sets the latter. And in t1000, we unset GIT_TEMPLATE_DIR, which is explicitly initialized by test-lib.sh. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 20, 2014 at 19:14 UTC 221bf985063737240124fe15c328cd125e9d048e
3 files changed -17
t/t0001-init.sh
-15
@@ -25,7 +25,6 @@ check_config () {
25
26 test_expect_success 'plain' '
27 (
28 - sane_unset GIT_DIR GIT_WORK_TREE &&
28 mkdir plain &&
29 cd plain &&
30 git init
@@ -35,7 +34,6 @@ test_expect_success 'plain' '
34
35 test_expect_success 'plain nested in bare' '
36 (
38 - sane_unset GIT_DIR GIT_WORK_TREE &&
37 git init --bare bare-ancestor.git &&
38 cd bare-ancestor.git &&
39 mkdir plain-nested &&
@@ -47,7 +45,6 @@ test_expect_success 'plain nested in bare' '
45
46 test_expect_success 'plain through aliased command, outside any git repo' '
47 (
50 - sane_unset GIT_DIR GIT_WORK_TREE &&
48 HOME=$(pwd)/alias-config &&
49 export HOME &&
50 mkdir alias-config &&
@@ -65,7 +62,6 @@ test_expect_success 'plain through aliased command, outside any git repo' '
62
63 test_expect_failure 'plain nested through aliased command' '
64 (
68 - sane_unset GIT_DIR GIT_WORK_TREE &&
65 git init plain-ancestor-aliased &&
66 cd plain-ancestor-aliased &&
67 echo "[alias] aliasedinit = init" >>.git/config &&
@@ -78,7 +74,6 @@ test_expect_failure 'plain nested through aliased command' '
74
75 test_expect_failure 'plain nested in bare through aliased command' '
76 (
81 - sane_unset GIT_DIR GIT_WORK_TREE &&
77 git init --bare bare-ancestor-aliased.git &&
78 cd bare-ancestor-aliased.git &&
79 echo "[alias] aliasedinit = init" >>config &&
@@ -91,7 +86,6 @@ test_expect_failure 'plain nested in bare through aliased command' '
86
87 test_expect_success 'plain with GIT_WORK_TREE' '
88 if (
94 - sane_unset GIT_DIR &&
89 mkdir plain-wt &&
90 cd plain-wt &&
91 GIT_WORK_TREE=$(pwd) git init
@@ -104,7 +98,6 @@ test_expect_success 'plain with GIT_WORK_TREE' '
98
99 test_expect_success 'plain bare' '
100 (
107 - sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
101 mkdir plain-bare-1 &&
102 cd plain-bare-1 &&
103 git --bare init
@@ -114,7 +107,6 @@ test_expect_success 'plain bare' '
107
108 test_expect_success 'plain bare with GIT_WORK_TREE' '
109 if (
117 - sane_unset GIT_DIR GIT_CONFIG &&
110 mkdir plain-bare-2 &&
111 cd plain-bare-2 &&
112 GIT_WORK_TREE=$(pwd) git --bare init
@@ -128,7 +120,6 @@ test_expect_success 'plain bare with GIT_WORK_TREE' '
120 test_expect_success 'GIT_DIR bare' '
121
122 (
131 - sane_unset GIT_CONFIG &&
123 mkdir git-dir-bare.git &&
124 GIT_DIR=git-dir-bare.git git init
125 ) &&
@@ -138,7 +129,6 @@ test_expect_success 'GIT_DIR bare' '
129 test_expect_success 'init --bare' '
130
131 (
141 - sane_unset GIT_DIR GIT_WORK_TREE GIT_CONFIG &&
132 mkdir init-bare.git &&
133 cd init-bare.git &&
134 git init --bare
@@ -149,7 +139,6 @@ test_expect_success 'init --bare' '
139 test_expect_success 'GIT_DIR non-bare' '
140
141 (
152 - sane_unset GIT_CONFIG &&
142 mkdir non-bare &&
143 cd non-bare &&
144 GIT_DIR=.git git init
@@ -160,7 +149,6 @@ test_expect_success 'GIT_DIR non-bare' '
149 test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
150
151 (
163 - sane_unset GIT_CONFIG &&
152 mkdir git-dir-wt-1.git &&
153 GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
154 ) &&
@@ -170,7 +158,6 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' '
158 test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
159
160 if (
173 - sane_unset GIT_CONFIG &&
161 mkdir git-dir-wt-2.git &&
162 GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init
163 )
@@ -183,8 +170,6 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
170 test_expect_success 'reinit' '
171
172 (
186 - sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
187 -
173 mkdir again &&
174 cd again &&
175 git init >out1 2>err1 &&
t/t9130-git-svn-authors-file.sh
-1
@@ -97,7 +97,6 @@ test_expect_success 'fresh clone with svn.authors-file in config' '
97 test x = x"$(git config svn.authorsfile)" &&
98 test_config="$HOME"/.gitconfig &&
99 sane_unset GIT_DIR &&
100 - sane_unset GIT_CONFIG &&
100 git config --global \
101 svn.authorsfile "$HOME"/svn-authors &&
102 test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
t/t9400-git-cvsserver-server.sh
-1
@@ -25,7 +25,6 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
25 test_done
26 }
27
28 -unset GIT_DIR GIT_CONFIG
28 WORKDIR=$(pwd)
29 SERVERDIR=$(pwd)/gitcvs.git
30 git_config="$SERVERDIR/config"