summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 13:37:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-13 13:37:22 (GMT)
commit67cf2fa3d5e2a81c535db22045eb06ba878c5f9f (patch)
tree42583731df181c58c04cc0c81db7b8238ebf17c0 /t
parentabb4824d13a44f68d1bbaf6726945983230771f9 (diff)
parent5400b2a2d989a4f09e7f666a41efac9ee3936f10 (diff)
downloadgit-67cf2fa3d5e2a81c535db22045eb06ba878c5f9f.zip
git-67cf2fa3d5e2a81c535db22045eb06ba878c5f9f.tar.gz
git-67cf2fa3d5e2a81c535db22045eb06ba878c5f9f.tar.bz2
Merge branch 'jt/tighten-fetch-proto-v2-response'
"git fetch" was a bit loose in parsing resposes from the other side when talking over the protocol v2. * jt/tighten-fetch-proto-v2-response: fetch-pack: be more precise in parsing v2 response
Diffstat (limited to 't')
-rwxr-xr-xt/t5702-protocol-v2.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 6ab8dea..0f2b09e 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -537,6 +537,56 @@ test_expect_success 'push with http:// and a config of v2 does not request v2' '
! grep "git< version 2" log
'
+test_expect_success 'when server sends "ready", expect DELIM' '
+ rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" http_child &&
+
+ git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one &&
+
+ git clone "$HTTPD_URL/smart/http_parent" http_child &&
+
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
+
+ # After "ready" in the acknowledgments section, pretend that a FLUSH
+ # (0000) was sent instead of a DELIM (0001).
+ printf "/ready/,$ s/0001/0000/" \
+ >"$HTTPD_ROOT_PATH/one-time-sed" &&
+
+ test_must_fail git -C http_child -c protocol.version=2 \
+ fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
+ test_i18ngrep "expected packfile to be sent after .ready." err
+'
+
+test_expect_success 'when server does not send "ready", expect FLUSH' '
+ rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" http_child log &&
+
+ git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one &&
+
+ git clone "$HTTPD_URL/smart/http_parent" http_child &&
+
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
+
+ # Create many commits to extend the negotiation phase across multiple
+ # requests, so that the server does not send "ready" in the first
+ # request.
+ for i in $(test_seq 1 32)
+ do
+ test_commit -C http_child c$i
+ done &&
+
+ # After the acknowledgments section, pretend that a DELIM
+ # (0001) was sent instead of a FLUSH (0000).
+ printf "/acknowledgments/,$ s/0000/0001/" \
+ >"$HTTPD_ROOT_PATH/one-time-sed" &&
+
+ test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \
+ -c protocol.version=2 \
+ fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
+ grep "fetch< acknowledgments" log &&
+ ! grep "fetch< ready" log &&
+ test_i18ngrep "expected no other sections to be sent after no .ready." err
+'
stop_httpd