transport: die if server options are unsupported
[git/raj.git] / t / t5702-protocol-v2.sh
blobf8912211e0ae56f4e8924016fb70a7bbf237016f
1 #!/bin/sh
3 test_description='test git wire-protocol version 2'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 # Test protocol v2 with 'git://' transport
11 . "$TEST_DIRECTORY"/lib-git-daemon.sh
12 start_git_daemon --export-all --enable=receive-pack
13 daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent
15 test_expect_success 'create repo to be served by git-daemon' '
16 git init "$daemon_parent" &&
17 test_commit -C "$daemon_parent" one
20 test_expect_success 'list refs with git:// using protocol v2' '
21 test_when_finished "rm -f log" &&
23 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
24 ls-remote --symref "$GIT_DAEMON_URL/parent" >actual &&
26 # Client requested to use protocol v2
27 grep "git> .*\\\0\\\0version=2\\\0$" log &&
28 # Server responded using protocol v2
29 grep "git< version 2" log &&
31 git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect &&
32 test_cmp expect actual
35 test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' '
36 test_when_finished "rm -f log" &&
38 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
39 ls-remote "$GIT_DAEMON_URL/parent" master >actual &&
41 cat >expect <<-EOF &&
42 $(git -C "$daemon_parent" rev-parse refs/heads/master)$(printf "\t")refs/heads/master
43 EOF
45 test_cmp expect actual
48 test_expect_success 'clone with git:// using protocol v2' '
49 test_when_finished "rm -f log" &&
51 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
52 clone "$GIT_DAEMON_URL/parent" daemon_child &&
54 git -C daemon_child log -1 --format=%s >actual &&
55 git -C "$daemon_parent" log -1 --format=%s >expect &&
56 test_cmp expect actual &&
58 # Client requested to use protocol v2
59 grep "clone> .*\\\0\\\0version=2\\\0$" log &&
60 # Server responded using protocol v2
61 grep "clone< version 2" log
64 test_expect_success 'fetch with git:// using protocol v2' '
65 test_when_finished "rm -f log" &&
67 test_commit -C "$daemon_parent" two &&
69 GIT_TRACE_PACKET="$(pwd)/log" git -C daemon_child -c protocol.version=2 \
70 fetch &&
72 git -C daemon_child log -1 --format=%s origin/master >actual &&
73 git -C "$daemon_parent" log -1 --format=%s >expect &&
74 test_cmp expect actual &&
76 # Client requested to use protocol v2
77 grep "fetch> .*\\\0\\\0version=2\\\0$" log &&
78 # Server responded using protocol v2
79 grep "fetch< version 2" log
82 test_expect_success 'fetch by hash without tag following with protocol v2 does not list refs' '
83 test_when_finished "rm -f log" &&
85 test_commit -C "$daemon_parent" two_a &&
86 git -C "$daemon_parent" rev-parse two_a >two_a_hash &&
88 GIT_TRACE_PACKET="$(pwd)/log" git -C daemon_child -c protocol.version=2 \
89 fetch --no-tags origin $(cat two_a_hash) &&
91 grep "fetch< version 2" log &&
92 ! grep "fetch> command=ls-refs" log
95 test_expect_success 'pull with git:// using protocol v2' '
96 test_when_finished "rm -f log" &&
98 GIT_TRACE_PACKET="$(pwd)/log" git -C daemon_child -c protocol.version=2 \
99 pull &&
101 git -C daemon_child log -1 --format=%s >actual &&
102 git -C "$daemon_parent" log -1 --format=%s >expect &&
103 test_cmp expect actual &&
105 # Client requested to use protocol v2
106 grep "fetch> .*\\\0\\\0version=2\\\0$" log &&
107 # Server responded using protocol v2
108 grep "fetch< version 2" log
111 test_expect_success 'push with git:// and a config of v2 does not request v2' '
112 test_when_finished "rm -f log" &&
114 # Till v2 for push is designed, make sure that if a client has
115 # protocol.version configured to use v2, that the client instead falls
116 # back and uses v0.
118 test_commit -C daemon_child three &&
120 # Push to another branch, as the target repository has the
121 # master branch checked out and we cannot push into it.
122 GIT_TRACE_PACKET="$(pwd)/log" git -C daemon_child -c protocol.version=2 \
123 push origin HEAD:client_branch &&
125 git -C daemon_child log -1 --format=%s >actual &&
126 git -C "$daemon_parent" log -1 --format=%s client_branch >expect &&
127 test_cmp expect actual &&
129 # Client requested to use protocol v2
130 ! grep "push> .*\\\0\\\0version=2\\\0$" log &&
131 # Server responded using protocol v2
132 ! grep "push< version 2" log
135 stop_git_daemon
137 # Test protocol v2 with 'file://' transport
139 test_expect_success 'create repo to be served by file:// transport' '
140 git init file_parent &&
141 test_commit -C file_parent one
144 test_expect_success 'list refs with file:// using protocol v2' '
145 test_when_finished "rm -f log" &&
147 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
148 ls-remote --symref "file://$(pwd)/file_parent" >actual &&
150 # Server responded using protocol v2
151 grep "git< version 2" log &&
153 git ls-remote --symref "file://$(pwd)/file_parent" >expect &&
154 test_cmp expect actual
157 test_expect_success 'ref advertisment is filtered with ls-remote using protocol v2' '
158 test_when_finished "rm -f log" &&
160 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
161 ls-remote "file://$(pwd)/file_parent" master >actual &&
163 cat >expect <<-EOF &&
164 $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
167 test_cmp expect actual
170 test_expect_success 'server-options are sent when using ls-remote' '
171 test_when_finished "rm -f log" &&
173 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
174 ls-remote -o hello -o world "file://$(pwd)/file_parent" master >actual &&
176 cat >expect <<-EOF &&
177 $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
180 test_cmp expect actual &&
181 grep "server-option=hello" log &&
182 grep "server-option=world" log
185 test_expect_success 'warn if using server-option with ls-remote with legacy protocol' '
186 test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -c protocol.version=0 \
187 ls-remote -o hello -o world "file://$(pwd)/file_parent" master 2>err &&
189 test_i18ngrep "see protocol.version in" err &&
190 test_i18ngrep "server options require protocol version 2 or later" err
193 test_expect_success 'clone with file:// using protocol v2' '
194 test_when_finished "rm -f log" &&
196 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
197 clone "file://$(pwd)/file_parent" file_child &&
199 git -C file_child log -1 --format=%s >actual &&
200 git -C file_parent log -1 --format=%s >expect &&
201 test_cmp expect actual &&
203 # Server responded using protocol v2
204 grep "clone< version 2" log &&
206 # Client sent ref-prefixes to filter the ref-advertisement
207 grep "ref-prefix HEAD" log &&
208 grep "ref-prefix refs/heads/" log &&
209 grep "ref-prefix refs/tags/" log
212 test_expect_success 'fetch with file:// using protocol v2' '
213 test_when_finished "rm -f log" &&
215 test_commit -C file_parent two &&
217 GIT_TRACE_PACKET="$(pwd)/log" git -C file_child -c protocol.version=2 \
218 fetch origin &&
220 git -C file_child log -1 --format=%s origin/master >actual &&
221 git -C file_parent log -1 --format=%s >expect &&
222 test_cmp expect actual &&
224 # Server responded using protocol v2
225 grep "fetch< version 2" log
228 test_expect_success 'ref advertisment is filtered during fetch using protocol v2' '
229 test_when_finished "rm -f log" &&
231 test_commit -C file_parent three &&
232 git -C file_parent branch unwanted-branch three &&
234 GIT_TRACE_PACKET="$(pwd)/log" git -C file_child -c protocol.version=2 \
235 fetch origin master &&
237 git -C file_child log -1 --format=%s origin/master >actual &&
238 git -C file_parent log -1 --format=%s >expect &&
239 test_cmp expect actual &&
241 grep "refs/heads/master" log &&
242 ! grep "refs/heads/unwanted-branch" log
245 test_expect_success 'server-options are sent when fetching' '
246 test_when_finished "rm -f log" &&
248 test_commit -C file_parent four &&
250 GIT_TRACE_PACKET="$(pwd)/log" git -C file_child -c protocol.version=2 \
251 fetch -o hello -o world origin master &&
253 git -C file_child log -1 --format=%s origin/master >actual &&
254 git -C file_parent log -1 --format=%s >expect &&
255 test_cmp expect actual &&
257 grep "server-option=hello" log &&
258 grep "server-option=world" log
261 test_expect_success 'warn if using server-option with fetch with legacy protocol' '
262 test_when_finished "rm -rf temp_child" &&
264 git init temp_child &&
266 test_must_fail env GIT_TEST_PROTOCOL_VERSION=0 git -C temp_child -c protocol.version=0 \
267 fetch -o hello -o world "file://$(pwd)/file_parent" master 2>err &&
269 test_i18ngrep "see protocol.version in" err &&
270 test_i18ngrep "server options require protocol version 2 or later" err
273 test_expect_success 'upload-pack respects config using protocol v2' '
274 git init server &&
275 write_script server/.git/hook <<-\EOF &&
276 touch hookout
277 "$@"
279 test_commit -C server one &&
281 test_config_global uploadpack.packobjectshook ./hook &&
282 test_path_is_missing server/.git/hookout &&
283 git -c protocol.version=2 clone "file://$(pwd)/server" client &&
284 test_path_is_file server/.git/hookout
287 test_expect_success 'setup filter tests' '
288 rm -rf server client &&
289 git init server &&
291 # 1 commit to create a file, and 1 commit to modify it
292 test_commit -C server message1 a.txt &&
293 test_commit -C server message2 a.txt &&
294 git -C server config protocol.version 2 &&
295 git -C server config uploadpack.allowfilter 1 &&
296 git -C server config uploadpack.allowanysha1inwant 1 &&
297 git -C server config protocol.version 2
300 test_expect_success 'partial clone' '
301 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 \
302 clone --filter=blob:none "file://$(pwd)/server" client &&
303 grep "version 2" trace &&
305 # Ensure that the old version of the file is missing
306 git -C client rev-list --quiet --objects --missing=print master \
307 >observed.oids &&
308 grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
310 # Ensure that client passes fsck
311 git -C client fsck
314 test_expect_success 'dynamically fetch missing object' '
315 rm "$(pwd)/trace" &&
316 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
317 cat-file -p $(git -C server rev-parse message1:a.txt) &&
318 grep "version 2" trace
321 test_expect_success 'when dynamically fetching missing object, do not list refs' '
322 ! grep "git> command=ls-refs" trace
325 test_expect_success 'partial fetch' '
326 rm -rf client "$(pwd)/trace" &&
327 git init client &&
328 SERVER="file://$(pwd)/server" &&
329 test_config -C client extensions.partialClone "$SERVER" &&
331 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
332 fetch --filter=blob:none "$SERVER" master:refs/heads/other &&
333 grep "version 2" trace &&
335 # Ensure that the old version of the file is missing
336 git -C client rev-list --quiet --objects --missing=print other \
337 >observed.oids &&
338 grep "$(git -C server rev-parse message1:a.txt)" observed.oids &&
340 # Ensure that client passes fsck
341 git -C client fsck
344 test_expect_success 'do not advertise filter if not configured to do so' '
345 SERVER="file://$(pwd)/server" &&
347 rm "$(pwd)/trace" &&
348 git -C server config uploadpack.allowfilter 1 &&
349 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 \
350 ls-remote "$SERVER" &&
351 grep "fetch=.*filter" trace &&
353 rm "$(pwd)/trace" &&
354 git -C server config uploadpack.allowfilter 0 &&
355 GIT_TRACE_PACKET="$(pwd)/trace" git -c protocol.version=2 \
356 ls-remote "$SERVER" &&
357 grep "fetch=" trace >fetch_capabilities &&
358 ! grep filter fetch_capabilities
361 test_expect_success 'partial clone warns if filter is not advertised' '
362 rm -rf client &&
363 git -C server config uploadpack.allowfilter 0 &&
364 git -c protocol.version=2 \
365 clone --filter=blob:none "file://$(pwd)/server" client 2>err &&
366 test_i18ngrep "filtering not recognized by server, ignoring" err
369 test_expect_success 'even with handcrafted request, filter does not work if not advertised' '
370 git -C server config uploadpack.allowfilter 0 &&
372 # Custom request that tries to filter even though it is not advertised.
373 test-tool pkt-line pack >in <<-EOF &&
374 command=fetch
375 0001
376 want $(git -C server rev-parse master)
377 filter blob:none
378 0000
381 test_must_fail git -C server serve --stateless-rpc <in >/dev/null 2>err &&
382 grep "unexpected line: .filter blob:none." err &&
384 # Exercise to ensure that if advertised, filter works
385 git -C server config uploadpack.allowfilter 1 &&
386 git -C server serve --stateless-rpc <in >/dev/null
389 test_expect_success 'default refspec is used to filter ref when fetchcing' '
390 test_when_finished "rm -f log" &&
392 GIT_TRACE_PACKET="$(pwd)/log" git -C file_child -c protocol.version=2 \
393 fetch origin &&
395 git -C file_child log -1 --format=%s three >actual &&
396 git -C file_parent log -1 --format=%s three >expect &&
397 test_cmp expect actual &&
399 grep "ref-prefix refs/heads/" log &&
400 grep "ref-prefix refs/tags/" log
403 test_expect_success 'fetch supports various ways of have lines' '
404 rm -rf server client trace &&
405 git init server &&
406 test_commit -C server dwim &&
407 TREE=$(git -C server rev-parse HEAD^{tree}) &&
408 git -C server tag exact \
409 $(git -C server commit-tree -m a "$TREE") &&
410 git -C server tag dwim-unwanted \
411 $(git -C server commit-tree -m b "$TREE") &&
412 git -C server tag exact-unwanted \
413 $(git -C server commit-tree -m c "$TREE") &&
414 git -C server tag prefix1 \
415 $(git -C server commit-tree -m d "$TREE") &&
416 git -C server tag prefix2 \
417 $(git -C server commit-tree -m e "$TREE") &&
418 git -C server tag fetch-by-sha1 \
419 $(git -C server commit-tree -m f "$TREE") &&
420 git -C server tag completely-unrelated \
421 $(git -C server commit-tree -m g "$TREE") &&
423 git init client &&
424 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
425 fetch "file://$(pwd)/server" \
426 dwim \
427 refs/tags/exact \
428 refs/tags/prefix*:refs/tags/prefix* \
429 "$(git -C server rev-parse fetch-by-sha1)" &&
431 # Ensure that the appropriate prefixes are sent (using a sample)
432 grep "fetch> ref-prefix dwim" trace &&
433 grep "fetch> ref-prefix refs/heads/dwim" trace &&
434 grep "fetch> ref-prefix refs/tags/prefix" trace &&
436 # Ensure that the correct objects are returned
437 git -C client cat-file -e $(git -C server rev-parse dwim) &&
438 git -C client cat-file -e $(git -C server rev-parse exact) &&
439 git -C client cat-file -e $(git -C server rev-parse prefix1) &&
440 git -C client cat-file -e $(git -C server rev-parse prefix2) &&
441 git -C client cat-file -e $(git -C server rev-parse fetch-by-sha1) &&
442 test_must_fail git -C client cat-file -e \
443 $(git -C server rev-parse dwim-unwanted) &&
444 test_must_fail git -C client cat-file -e \
445 $(git -C server rev-parse exact-unwanted) &&
446 test_must_fail git -C client cat-file -e \
447 $(git -C server rev-parse completely-unrelated)
450 test_expect_success 'fetch supports include-tag and tag following' '
451 rm -rf server client trace &&
452 git init server &&
454 test_commit -C server to_fetch &&
455 git -C server tag -a annotated_tag -m message &&
457 git init client &&
458 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
459 fetch "$(pwd)/server" to_fetch:to_fetch &&
461 grep "fetch> ref-prefix to_fetch" trace &&
462 grep "fetch> ref-prefix refs/tags/" trace &&
463 grep "fetch> include-tag" trace &&
465 git -C client cat-file -e $(git -C client rev-parse annotated_tag)
468 test_expect_success 'upload-pack respects client shallows' '
469 rm -rf server client trace &&
471 git init server &&
472 test_commit -C server base &&
473 test_commit -C server client_has &&
475 git clone --depth=1 "file://$(pwd)/server" client &&
477 # Add extra commits to the client so that the whole fetch takes more
478 # than 1 request (due to negotiation)
479 for i in $(test_seq 1 32)
481 test_commit -C client c$i
482 done &&
484 git -C server checkout -b newbranch base &&
485 test_commit -C server client_wants &&
487 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
488 fetch origin newbranch &&
489 # Ensure that protocol v2 is used
490 grep "fetch< version 2" trace
493 test_expect_success 'ensure that multiple fetches in same process from a shallow repo works' '
494 rm -rf server client trace &&
496 test_create_repo server &&
497 test_commit -C server one &&
498 test_commit -C server two &&
499 test_commit -C server three &&
500 git clone --shallow-exclude two "file://$(pwd)/server" client &&
502 git -C server tag -a -m "an annotated tag" twotag two &&
504 # Triggers tag following (thus, 2 fetches in one process)
505 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
506 fetch --shallow-exclude one origin &&
507 # Ensure that protocol v2 is used
508 grep "fetch< version 2" trace
511 test_expect_success 'deepen-relative' '
512 rm -rf server client trace &&
514 test_create_repo server &&
515 test_commit -C server one &&
516 test_commit -C server two &&
517 test_commit -C server three &&
518 git clone --depth 1 "file://$(pwd)/server" client &&
519 test_commit -C server four &&
521 # Sanity check that only "three" is downloaded
522 git -C client log --pretty=tformat:%s master >actual &&
523 echo three >expected &&
524 test_cmp expected actual &&
526 GIT_TRACE_PACKET="$(pwd)/trace" git -C client -c protocol.version=2 \
527 fetch --deepen=1 origin &&
528 # Ensure that protocol v2 is used
529 grep "fetch< version 2" trace &&
531 git -C client log --pretty=tformat:%s origin/master >actual &&
532 cat >expected <<-\EOF &&
533 four
534 three
537 test_cmp expected actual
540 # Test protocol v2 with 'http://' transport
542 . "$TEST_DIRECTORY"/lib-httpd.sh
543 start_httpd
545 test_expect_success 'create repo to be served by http:// transport' '
546 git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
547 git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config http.receivepack true &&
548 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one
551 test_expect_success 'clone with http:// using protocol v2' '
552 test_when_finished "rm -f log" &&
554 GIT_TRACE_PACKET="$(pwd)/log" GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \
555 clone "$HTTPD_URL/smart/http_parent" http_child &&
557 git -C http_child log -1 --format=%s >actual &&
558 git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s >expect &&
559 test_cmp expect actual &&
561 # Client requested to use protocol v2
562 grep "Git-Protocol: version=2" log &&
563 # Server responded using protocol v2
564 grep "git< version 2" log
567 test_expect_success 'fetch with http:// using protocol v2' '
568 test_when_finished "rm -f log" &&
570 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
572 GIT_TRACE_PACKET="$(pwd)/log" git -C http_child -c protocol.version=2 \
573 fetch &&
575 git -C http_child log -1 --format=%s origin/master >actual &&
576 git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s >expect &&
577 test_cmp expect actual &&
579 # Server responded using protocol v2
580 grep "git< version 2" log
583 test_expect_success 'fetch from namespaced repo respects namespaces' '
584 test_when_finished "rm -f log" &&
586 git init "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" &&
587 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" one &&
588 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" two &&
589 git -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" \
590 update-ref refs/namespaces/ns/refs/heads/master one &&
592 GIT_TRACE_PACKET="$(pwd)/log" git -C http_child -c protocol.version=2 \
593 fetch "$HTTPD_URL/smart_namespace/nsrepo" \
594 refs/heads/master:refs/heads/theirs &&
596 # Server responded using protocol v2
597 grep "fetch< version 2" log &&
599 git -C "$HTTPD_DOCUMENT_ROOT_PATH/nsrepo" rev-parse one >expect &&
600 git -C http_child rev-parse theirs >actual &&
601 test_cmp expect actual
604 test_expect_success 'push with http:// and a config of v2 does not request v2' '
605 test_when_finished "rm -f log" &&
606 # Till v2 for push is designed, make sure that if a client has
607 # protocol.version configured to use v2, that the client instead falls
608 # back and uses v0.
610 test_commit -C http_child three &&
612 # Push to another branch, as the target repository has the
613 # master branch checked out and we cannot push into it.
614 GIT_TRACE_PACKET="$(pwd)/log" git -C http_child -c protocol.version=2 \
615 push origin HEAD:client_branch &&
617 git -C http_child log -1 --format=%s >actual &&
618 git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s client_branch >expect &&
619 test_cmp expect actual &&
621 # Client didnt request to use protocol v2
622 ! grep "Git-Protocol: version=2" log &&
623 # Server didnt respond using protocol v2
624 ! grep "git< version 2" log
627 test_expect_success 'when server sends "ready", expect DELIM' '
628 rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" http_child &&
630 git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
631 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one &&
633 git clone "$HTTPD_URL/smart/http_parent" http_child &&
635 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
637 # After "ready" in the acknowledgments section, pretend that a FLUSH
638 # (0000) was sent instead of a DELIM (0001).
639 printf "/ready/,$ s/0001/0000/" \
640 >"$HTTPD_ROOT_PATH/one-time-sed" &&
642 test_must_fail git -C http_child -c protocol.version=2 \
643 fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
644 test_i18ngrep "expected packfile to be sent after .ready." err
647 test_expect_success 'when server does not send "ready", expect FLUSH' '
648 rm -rf "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" http_child log &&
650 git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
651 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one &&
653 git clone "$HTTPD_URL/smart/http_parent" http_child &&
655 test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
657 # Create many commits to extend the negotiation phase across multiple
658 # requests, so that the server does not send "ready" in the first
659 # request.
660 for i in $(test_seq 1 32)
662 test_commit -C http_child c$i
663 done &&
665 # After the acknowledgments section, pretend that a DELIM
666 # (0001) was sent instead of a FLUSH (0000).
667 printf "/acknowledgments/,$ s/0000/0001/" \
668 >"$HTTPD_ROOT_PATH/one-time-sed" &&
670 test_must_fail env GIT_TRACE_PACKET="$(pwd)/log" git -C http_child \
671 -c protocol.version=2 \
672 fetch "$HTTPD_URL/one_time_sed/http_parent" 2> err &&
673 grep "fetch< .*acknowledgments" log &&
674 ! grep "fetch< .*ready" log &&
675 test_i18ngrep "expected no other sections to be sent after no .ready." err
678 stop_httpd
680 test_done