diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-08-04 20:53:57 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-04 20:53:57 (GMT) |
commit | 5c454b3825777493eada736423db75e8b128dd83 (patch) | |
tree | 6585964978437d99448ab9d4ac0bc33c88c81156 /t | |
parent | a1315123e22b6996d68c090fa74dbba483bb1d52 (diff) | |
parent | e00549aa9b19cc85c8bf3c3efd0a466aaf5e08f3 (diff) | |
download | git-5c454b3825777493eada736423db75e8b128dd83.zip git-5c454b3825777493eada736423db75e8b128dd83.tar.gz git-5c454b3825777493eada736423db75e8b128dd83.tar.bz2 |
Merge branch 'jt/pack-objects-prefetch-in-batch'
While packing many objects in a repository with a promissor remote,
lazily fetching missing objects from the promissor remote one by
one may be inefficient---the code now attempts to fetch all the
missing objects in batch (obviously this won't work for a lazy
clone that lazily fetches tree objects as you cannot even enumerate
what blobs are missing until you learn which trees are missing).
* jt/pack-objects-prefetch-in-batch:
pack-objects: prefetch objects to be packed
pack-objects: refactor to oid_object_info_extended
Diffstat (limited to 't')
-rwxr-xr-x | t/t5300-pack-object.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 746cdb6..d553d0c 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -497,4 +497,40 @@ test_expect_success 'make sure index-pack detects the SHA1 collision (large blob ) ' +test_expect_success 'prefetch objects' ' + rm -rf server client && + + git init server && + test_config -C server uploadpack.allowanysha1inwant 1 && + test_config -C server uploadpack.allowfilter 1 && + test_config -C server protocol.version 2 && + + echo one >server/one && + git -C server add one && + git -C server commit -m one && + git -C server branch one_branch && + + echo two_a >server/two_a && + echo two_b >server/two_b && + git -C server add two_a two_b && + git -C server commit -m two && + + echo three >server/three && + git -C server add three && + git -C server commit -m three && + git -C server branch three_branch && + + # Clone, fetch "two" with blobs excluded, and re-push it. This requires + # the client to have the blobs of "two" - verify that these are + # prefetched in one batch. + git clone --filter=blob:none --single-branch -b one_branch \ + "file://$(pwd)/server" client && + test_config -C client protocol.version 2 && + TWO=$(git -C server rev-parse three_branch^) && + git -C client fetch --filter=blob:none origin "$TWO" && + GIT_TRACE_PACKET=$(pwd)/trace git -C client push origin "$TWO":refs/heads/two_branch && + grep "git> done" trace >donelines && + test_line_count = 1 donelines +' + test_done |