t/lib-proto-disable: restore protocol.allow after config tests

The tests for protocol.allow actually set that variable in the on-disk config, run a series of tests, and then never clean up after themselves. This means that whatever tests we run after have protocol.allow=never, which may influence their results. In most cases we either exit after running these tests, or do another round of test_proto(). In the latter case, this happens to work because: 1. Tests of the GIT_ALLOW_PROTOCOL environment variable override the config. 2. Tests of the specific config "protocol.foo.allow" override the protocol.allow config. 3. The next round of protocol.allow tests start off by setting the config to a known value. However, it's a land-mine waiting to trap somebody adding new tests to one of the t581x test scripts. Let's make sure we clean up after ourselves. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 28, 2017 at 17:47 UTC 30c586ff15935d4439ab31f9ab8424f28e6b461e
1 file changed +6 -2
t/lib-proto-disable.sh
+6 -2
@@ -147,29 +147,33 @@ test_config () {
147 # Test clone/fetch/push with protocol.allow user defined default
148 test_expect_success "clone $desc (enabled)" '
149 rm -rf tmp.git &&
150 - git config --global protocol.allow always &&
150 + test_config_global protocol.allow always &&
151 git clone --bare "$url" tmp.git
152 '
153
154 test_expect_success "fetch $desc (enabled)" '
155 + test_config_global protocol.allow always &&
156 git -C tmp.git fetch
157 '
158
159 test_expect_success "push $desc (enabled)" '
160 + test_config_global protocol.allow always &&
161 git -C tmp.git push origin HEAD:pushed
162 '
163
164 test_expect_success "push $desc (disabled)" '
163 - git config --global protocol.allow never &&
165 + test_config_global protocol.allow never &&
166 test_must_fail git -C tmp.git push origin HEAD:pushed
167 '
168
169 test_expect_success "fetch $desc (disabled)" '
170 + test_config_global protocol.allow never &&
171 test_must_fail git -C tmp.git fetch
172 '
173
174 test_expect_success "clone $desc (disabled)" '
175 rm -rf tmp.git &&
176 + test_config_global protocol.allow never &&
177 test_must_fail git clone --bare "$url" tmp.git
178 '
179 }