| 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git read-tree in partial clones' |
| 4 | |
| 5 | TEST_NO_CREATE_REPO=1 |
| 6 | . ./test-lib.sh |
| 7 | |
| 8 | test_expect_success 'read-tree in partial clone prefetches in one batch' ' |
| 9 | test_when_finished "rm -rf server client trace" && |
| 10 | |
| 11 | git init server && |
| 12 | echo foo >server/one && |
| 13 | echo bar >server/two && |
| 14 | git -C server add one two && |
| 15 | git -C server commit -m "initial commit" && |
| 16 | TREE=$(git -C server rev-parse HEAD^{tree}) && |
| 17 | |
| 18 | git -C server config uploadpack.allowfilter 1 && |
| 19 | git -C server config uploadpack.allowanysha1inwant 1 && |
| 20 | git clone --bare --filter=blob:none "file://$(pwd)/server" client && |
| 21 | GIT_TRACE_PACKET="$(pwd)/trace" git -C client read-tree $TREE $TREE && |
| 22 | |
| 23 | # "done" marks the end of negotiation (once per fetch). Expect that |
| 24 | # only one fetch occurs. |
| 25 | grep "fetch> done" trace >donelines && |
| 26 | test_line_count = 1 donelines |
| 27 | ' |
| 28 | |
| 29 | test_done |