Skip to content

Commit d6509da

Browse files
jrngitster
authored andcommitted
fetch test: mark test of "skipping" haves as v0-only
Since 633a531 (fetch test: avoid use of "VAR= cmd" with a shell function, 2019-12-26), t5552.5 (do not send "have" with ancestors of commits that server ACKed) fails when run with GIT_TEST_PROTOCOL_VERSION=2. The cause: The progression of "have"s sent in negotiation depends on whether we are using a stateless RPC based transport or a stateful bidirectional one (see for example 44d8dc5, "Fix potential local deadlock during fetch-pack", 2011-03-29). In protocol v2, all transports are stateless transports, while in protocol v0, transports such as local access and ssh are stateful. In stateful transports, the number of "have"s to send multiplies by two each round until we reach PIPESAFE_FLUSH (that is, 32), and then it increases by PIPESAFE_FLUSH each round. In stateless transport, the count multiplies by two each round until we reach LARGE_FLUSH (which is 16384) and then multiplies by 1.1 each round after that. Moreover, in stateful transports, as fetch-pack.c explains: We keep one window "ahead" of the other side, and will wait for an ACK only on the next one. This affects t5552.5 because it looks for "have"s from the negotiator that appear in that second window. With protocol version 2, the second window never arrives, and the test fails. Until 633a531 (2019-12-26), a previous test in the same file contained GIT_TEST_PROTOCOL_VERSION= trace_fetch client origin to_fetch In many common shells (e.g. bash when run as "sh"), the setting of GIT_TEST_PROTOCOL_VERSION to the empty string lasts beyond the intended duration of the trace_fetch invocation. This causes it to override the GIT_TEST_PROTOCOL_VERSION setting that was passed in to the test during the remainder of the test script, so t5552.5 never got run using protocol v2 on those shells, regardless of the GIT_TEST_PROTOCOL_VERSION setting from the environment. 633a531 fixed that, revealing the failing test. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7fbf12 commit d6509da

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

t/t5552-skipping-fetch-negotiator.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,17 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC
173173
test_commit -C server commit-on-b1 &&
174174
175175
test_config -C client fetch.negotiationalgorithm skipping &&
176-
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+
) &&
177187
grep " fetch" trace &&
178188
179189
# fetch-pack sends 2 requests each containing 16 "have" lines before

0 commit comments

Comments
 (0)