3 test_description
='git read-tree in partial clones'
7 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
8 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
12 test_expect_success
'read-tree in partial clone prefetches in one batch' '
13 test_when_finished "rm -rf server client trace" &&
16 echo foo >server/one &&
17 echo bar >server/two &&
18 git -C server add one two &&
19 git -C server commit -m "initial commit" &&
20 TREE=$(git -C server rev-parse HEAD^{tree}) &&
22 git -C server config uploadpack.allowfilter 1 &&
23 git -C server config uploadpack.allowanysha1inwant 1 &&
24 git clone --bare --filter=blob:none "file://$(pwd)/server" client &&
25 GIT_TRACE_PACKET="$(pwd)/trace" git -C client read-tree $TREE &&
27 # "done" marks the end of negotiation (once per fetch). Expect that
28 # only one fetch occurs.
29 grep "fetch> done" trace >donelines &&
30 test_line_count = 1 donelines