Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2019-12-26 22:55:10 +0300
committerJunio C Hamano <gitster@pobox.com>2020-01-16 01:02:32 +0300
commitc7973f249ebe86f10ec4b420a8ab83b8b83bce22 (patch)
tree2cfe8f9524b3132794e96f66261c9f92b1015f36 /t/t5552-skipping-fetch-negotiator.sh
parentc58ae96fc4bb11916b62a96940bb70bb85ea5992 (diff)
fetch test: avoid use of "VAR= cmd" with a shell function
Just like assigning a nonempty value, assigning an empty value to a shell variable when calling a function produces non-portable behavior: in some shells, the assignment lasts for the duration of the function invocation, and in others, it persists after the function returns. Use an explicit subshell with the envvar exported to make the behavior consistent across shells and crystal clear. All previous instances of this pattern used "VAR=value" (with nonempty `value`), which is already diagnosed automatically by "make test-lint" since a0a630192d (t/check-non-portable-shell: detect "FOO=bar shell_func", 2018-07-13). Noticed using an improved "make test-lint". Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5552-skipping-fetch-negotiator.sh')
-rwxr-xr-xt/t5552-skipping-fetch-negotiator.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh
index f70cbcc9ca..a452fe32fa 100755
--- a/t/t5552-skipping-fetch-negotiator.sh
+++ b/t/t5552-skipping-fetch-negotiator.sh
@@ -107,7 +107,11 @@ test_expect_success 'use ref advertisement to filter out commits' '
# The ref advertisement itself is filtered when protocol v2 is used, so
# use v0.
- GIT_TEST_PROTOCOL_VERSION= trace_fetch client origin to_fetch &&
+ (
+ GIT_TEST_PROTOCOL_VERSION= &&
+ export GIT_TEST_PROTOCOL_VERSION &&
+ trace_fetch client origin to_fetch
+ ) &&
have_sent c5 c4^ c2side &&
have_not_sent c4 c4^^ c4^^^
'