summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-08-02 14:06:42 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-02 14:06:42 -0700
commit8230107f336b29d25111c517639b8cd5717c8416 (patch)
treeb24d756b13a4877290c6369d9833d8e6e8f28120 /t
parentMerge branch 'fc/pull-no-rebase-merges-theirs-into-ours' (diff)
parentcache-tree: prefetch in partial clone read-tree (diff)
downloadtgif-8230107f336b29d25111c517639b8cd5717c8416.tar.xz
Merge branch 'jt/bulk-prefetch'
"git read-tree" had a codepath where blobs are fetched one-by-one from the promisor remote, which has been corrected to fetch in bulk. * jt/bulk-prefetch: cache-tree: prefetch in partial clone read-tree unpack-trees: refactor prefetching code
Diffstat (limited to 't')
-rwxr-xr-xt/t1022-read-tree-partial-clone.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/t1022-read-tree-partial-clone.sh b/t/t1022-read-tree-partial-clone.sh
new file mode 100755
index 0000000000..a763e27c7d
--- /dev/null
+++ b/t/t1022-read-tree-partial-clone.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test_description='git read-tree in partial clones'
+
+TEST_NO_CREATE_REPO=1
+
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
+. ./test-lib.sh
+
+test_expect_success 'read-tree in partial clone prefetches in one batch' '
+ test_when_finished "rm -rf server client trace" &&
+
+ git init server &&
+ echo foo >server/one &&
+ echo bar >server/two &&
+ git -C server add one two &&
+ git -C server commit -m "initial commit" &&
+ TREE=$(git -C server rev-parse HEAD^{tree}) &&
+
+ git -C server config uploadpack.allowfilter 1 &&
+ git -C server config uploadpack.allowanysha1inwant 1 &&
+ git clone --bare --filter=blob:none "file://$(pwd)/server" client &&
+ GIT_TRACE_PACKET="$(pwd)/trace" git -C client read-tree $TREE &&
+
+ # "done" marks the end of negotiation (once per fetch). Expect that
+ # only one fetch occurs.
+ grep "fetch> done" trace >donelines &&
+ test_line_count = 1 donelines
+'
+
+test_done