@@ -17,7 +17,7 @@ test_allow_var () {
1717
1818 test_expect_success " fetch $desc (enabled)" '
1919 (
20- cd tmp.git &&
20+ cd tmp.git && GIT_DIR=. && export GIT_DIR &&
2121 GIT_ALLOW_PROTOCOL=$proto &&
2222 export GIT_ALLOW_PROTOCOL &&
2323 git fetch
@@ -26,7 +26,7 @@ test_allow_var () {
2626
2727 test_expect_success " push $desc (enabled)" '
2828 (
29- cd tmp.git &&
29+ cd tmp.git && GIT_DIR=. && export GIT_DIR &&
3030 GIT_ALLOW_PROTOCOL=$proto &&
3131 export GIT_ALLOW_PROTOCOL &&
3232 git push origin HEAD:pushed
@@ -35,7 +35,7 @@ test_allow_var () {
3535
3636 test_expect_success " push $desc (disabled)" '
3737 (
38- cd tmp.git &&
38+ cd tmp.git && GIT_DIR=. && export GIT_DIR &&
3939 GIT_ALLOW_PROTOCOL=none &&
4040 export GIT_ALLOW_PROTOCOL &&
4141 test_must_fail git push origin HEAD:pushed
@@ -44,7 +44,7 @@ test_allow_var () {
4444
4545 test_expect_success " fetch $desc (disabled)" '
4646 (
47- cd tmp.git &&
47+ cd tmp.git && GIT_DIR=. && export GIT_DIR &&
4848 GIT_ALLOW_PROTOCOL=none &&
4949 export GIT_ALLOW_PROTOCOL &&
5050 test_must_fail git fetch
@@ -83,19 +83,19 @@ test_config () {
8383 '
8484
8585 test_expect_success " fetch $desc (enabled)" '
86- git -C tmp.git -c protocol.$proto.allow=always fetch
86+ git --git-dir= tmp.git -c protocol.$proto.allow=always fetch
8787 '
8888
8989 test_expect_success " push $desc (enabled)" '
90- git -C tmp.git -c protocol.$proto.allow=always push origin HEAD:pushed
90+ git --git-dir= tmp.git -c protocol.$proto.allow=always push origin HEAD:pushed
9191 '
9292
9393 test_expect_success " push $desc (disabled)" '
94- test_must_fail git -C tmp.git -c protocol.$proto.allow=never push origin HEAD:pushed
94+ test_must_fail git --git-dir= tmp.git -c protocol.$proto.allow=never push origin HEAD:pushed
9595 '
9696
9797 test_expect_success " fetch $desc (disabled)" '
98- test_must_fail git -C tmp.git -c protocol.$proto.allow=never fetch
98+ test_must_fail git --git-dir= tmp.git -c protocol.$proto.allow=never fetch
9999 '
100100
101101 test_expect_success " clone $desc (disabled)" '
@@ -110,16 +110,16 @@ test_config () {
110110 '
111111
112112 test_expect_success " fetch $desc (enabled)" '
113- git -C tmp.git -c protocol.$proto.allow=user fetch
113+ git --git-dir= tmp.git -c protocol.$proto.allow=user fetch
114114 '
115115
116116 test_expect_success " push $desc (enabled)" '
117- git -C tmp.git -c protocol.$proto.allow=user push origin HEAD:pushed
117+ git --git-dir= tmp.git -c protocol.$proto.allow=user push origin HEAD:pushed
118118 '
119119
120120 test_expect_success " push $desc (disabled)" '
121121 (
122- cd tmp.git &&
122+ cd tmp.git && GIT_DIR=. && export GIT_DIR &&
123123 GIT_PROTOCOL_FROM_USER=0 &&
124124 export GIT_PROTOCOL_FROM_USER &&
125125 test_must_fail git -c protocol.$proto.allow=user push origin HEAD:pushed
@@ -128,7 +128,7 @@ test_config () {
128128
129129 test_expect_success " fetch $desc (disabled)" '
130130 (
131- cd tmp.git &&
131+ cd tmp.git && GIT_DIR=. && export GIT_DIR &&
132132 GIT_PROTOCOL_FROM_USER=0 &&
133133 export GIT_PROTOCOL_FROM_USER &&
134134 test_must_fail git -c protocol.$proto.allow=user fetch
@@ -153,22 +153,22 @@ test_config () {
153153
154154 test_expect_success " fetch $desc (enabled)" '
155155 test_config_global protocol.allow always &&
156- git -C tmp.git fetch
156+ git --git-dir= tmp.git fetch
157157 '
158158
159159 test_expect_success " push $desc (enabled)" '
160160 test_config_global protocol.allow always &&
161- git -C tmp.git push origin HEAD:pushed
161+ git --git-dir= tmp.git push origin HEAD:pushed
162162 '
163163
164164 test_expect_success " push $desc (disabled)" '
165165 test_config_global protocol.allow never &&
166- test_must_fail git -C tmp.git push origin HEAD:pushed
166+ test_must_fail git --git-dir= tmp.git push origin HEAD:pushed
167167 '
168168
169169 test_expect_success " fetch $desc (disabled)" '
170170 test_config_global protocol.allow never &&
171- test_must_fail git -C tmp.git fetch
171+ test_must_fail git --git-dir= tmp.git fetch
172172 '
173173
174174 test_expect_success " clone $desc (disabled)" '
0 commit comments