@@ -537,6 +537,56 @@ test_expect_success 'push with http:// and a config of v2 does not request v2' '
537
537
! grep "git< version 2" log
538
538
'
539
539
540
+ test_expect_success ' when server sends "ready", expect DELIM' '
541
+ rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" http_child &&
542
+
543
+ git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
544
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one &&
545
+
546
+ git clone "$HTTPD_URL/smart/http_parent" http_child &&
547
+
548
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
549
+
550
+ # After "ready" in the acknowledgments section, pretend that a FLUSH
551
+ # (0000) was sent instead of a DELIM (0001).
552
+ printf "/ready/,$ s/0001/0000/" \
553
+ >"$HTTPD_ROOT_PATH/one-time-sed" &&
554
+
555
+ test_must_fail git -C http_child -c protocol.version=2 \
556
+ fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
557
+ test_i18ngrep "expected packfile to be sent after .ready." err
558
+ '
559
+
560
+ test_expect_success ' when server does not send "ready", expect FLUSH' '
561
+ rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" http_child log &&
562
+
563
+ git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
564
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one &&
565
+
566
+ git clone "$HTTPD_URL/smart/http_parent" http_child &&
567
+
568
+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
569
+
570
+ # Create many commits to extend the negotiation phase across multiple
571
+ # requests, so that the server does not send "ready" in the first
572
+ # request.
573
+ for i in $(test_seq 1 32)
574
+ do
575
+ test_commit -C http_child c$i
576
+ done &&
577
+
578
+ # After the acknowledgments section, pretend that a DELIM
579
+ # (0001) was sent instead of a FLUSH (0000).
580
+ printf "/acknowledgments/,$ s/0000/0001/" \
581
+ >"$HTTPD_ROOT_PATH/one-time-sed" &&
582
+
583
+ test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \
584
+ -c protocol.version=2 \
585
+ fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
586
+ grep "fetch< acknowledgments" log &&
587
+ ! grep "fetch< ready" log &&
588
+ test_i18ngrep "expected no other sections to be sent after no .ready." err
589
+ '
540
590
541
591
stop_httpd
542
592
0 commit comments