Skip to content

Commit c7372c9

Browse files
committed
Merge branch 'jn/test-lint-one-shot-export-to-shell-function'
The test-lint machinery knew to check "VAR=VAL shell_function" construct, but did not check "VAR= shell_funciton", which has been corrected. * jn/test-lint-one-shot-export-to-shell-function: fetch test: mark test of "skipping" haves as v0-only t/check-non-portable-shell: detect "FOO= shell_func", too fetch test: avoid use of "VAR= cmd" with a shell function
2 parents 11ad30b + d6509da commit c7372c9

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

t/check-non-portable-shell.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ sub err {
4646
/(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)';
4747
/\bgrep\b.*--file\b/ and err 'grep --file FILE is not portable (use grep -f FILE)';
4848
/\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)';
49-
/^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
49+
/^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
5050
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
5151
$line = '';
5252
# this resets our $. for each file

t/t5552-skipping-fetch-negotiator.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ test_expect_success 'use ref advertisement to filter out commits' '
107107
108108
# The ref advertisement itself is filtered when protocol v2 is used, so
109109
# use v0.
110-
GIT_TEST_PROTOCOL_VERSION= trace_fetch client origin to_fetch &&
110+
(
111+
GIT_TEST_PROTOCOL_VERSION= &&
112+
export GIT_TEST_PROTOCOL_VERSION &&
113+
trace_fetch client origin to_fetch
114+
) &&
111115
have_sent c5 c4^ c2side &&
112116
have_not_sent c4 c4^^ c4^^^
113117
'
@@ -169,7 +173,17 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC
169173
test_commit -C server commit-on-b1 &&
170174
171175
test_config -C client fetch.negotiationalgorithm skipping &&
172-
trace_fetch client "$(pwd)/server" to_fetch &&
176+
177+
# NEEDSWORK: The number of "have"s sent depends on whether the transport
178+
# is stateful. If the overspecification of the result were reduced, this
179+
# test could be used for both stateful and stateless transports.
180+
(
181+
# Force protocol v0, in which local transport is stateful (in
182+
# protocol v2 it is stateless).
183+
GIT_TEST_PROTOCOL_VERSION=0 &&
184+
export GIT_TEST_PROTOCOL_VERSION &&
185+
trace_fetch client "$(pwd)/server" to_fetch
186+
) &&
173187
grep " fetch" trace &&
174188
175189
# fetch-pack sends 2 requests each containing 16 "have" lines before

0 commit comments

Comments
 (0)