Skip to content

Commit

Permalink
Merge branch 'jn/test-lint-one-shot-export-to-shell-function' into jch
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Jan 5, 2020
2 parents 7460319 + 586f2da commit 53ed9a8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion t/check-non-portable-shell.pl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sub err {
/(?:\$\(seq|^\s*seq\b)/ and err 'seq is not portable (use test_seq)';
/\bgrep\b.*--file\b/ and err 'grep --file FILE is not portable (use grep -f FILE)';
/\bexport\s+[A-Za-z0-9_]*=/ and err '"export FOO=bar" is not portable (use FOO=bar && export FOO)';
/^\s*([A-Z0-9_]+=(\w+|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
/^\s*([A-Z0-9_]+=(\w*|(["']).*?\3)\s+)+(\w+)/ and exists($func{$4}) and
err '"FOO=bar shell_func" assignment extends beyond "shell_func"';
$line = '';
# this resets our $. for each file
Expand Down
18 changes: 16 additions & 2 deletions t/t5552-skipping-fetch-negotiator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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^^^
'
Expand Down Expand Up @@ -169,7 +173,17 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC
test_commit -C server commit-on-b1 &&
test_config -C client fetch.negotiationalgorithm skipping &&
trace_fetch client "$(pwd)/server" to_fetch &&
# NEEDSWORK: The number of "have"s sent depends on whether the transport
# is stateful. If the overspecification of the result were reduced, this
# test could be used for both stateful and stateless transports.
(
# Force protocol v0, in which local transport is stateful (in
# protocol v2 it is stateless).
GIT_TEST_PROTOCOL_VERSION=0 &&
export GIT_TEST_PROTOCOL_VERSION &&
trace_fetch client "$(pwd)/server" to_fetch
) &&
grep " fetch" trace &&
# fetch-pack sends 2 requests each containing 16 "have" lines before
Expand Down

0 comments on commit 53ed9a8

Please sign in to comment.