]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5616-partial-clone.sh
Merge branch 'ea/blame-use-oideq'
[thirdparty/git.git] / t / t5616-partial-clone.sh
index 8827c2ed18394f3f7f5ae4bd35c3514a36eacc9d..f4d49d833577c33f741adfb8e5ded0cdae2a4a8b 100755 (executable)
@@ -163,6 +163,22 @@ test_expect_success 'manual prefetch of missing objects' '
        test_line_count = 0 observed.oids
 '
 
+test_expect_success 'partial clone with transfer.fsckobjects=1 works with submodules' '
+       test_create_repo submodule &&
+       test_commit -C submodule mycommit &&
+
+       test_create_repo src_with_sub &&
+       test_config -C src_with_sub uploadpack.allowfilter 1 &&
+       test_config -C src_with_sub uploadpack.allowanysha1inwant 1 &&
+
+       git -C src_with_sub submodule add "file://$(pwd)/submodule" mysub &&
+       git -C src_with_sub commit -m "commit with submodule" &&
+
+       git -c transfer.fsckobjects=1 \
+               clone --filter="blob:none" "file://$(pwd)/src_with_sub" dst &&
+       test_when_finished rm -rf dst
+'
+
 test_expect_success 'partial clone with transfer.fsckobjects=1 uses index-pack --fsck-objects' '
        git init src &&
        test_commit -C src x &&
@@ -417,6 +433,26 @@ test_expect_success 'fetch lazy-fetches only to resolve deltas, protocol v2' '
        grep "want $(cat hash)" trace
 '
 
+test_expect_success 'fetch does not lazy-fetch missing targets of its refs' '
+       rm -rf server client trace &&
+
+       test_create_repo server &&
+       test_config -C server uploadpack.allowfilter 1 &&
+       test_config -C server uploadpack.allowanysha1inwant 1 &&
+       test_commit -C server foo &&
+
+       git clone --filter=blob:none "file://$(pwd)/server" client &&
+       # Make all refs point to nothing by deleting all objects.
+       rm client/.git/objects/pack/* &&
+
+       test_commit -C server bar &&
+       GIT_TRACE_PACKET="$(pwd)/trace" git -C client fetch \
+               --no-tags --recurse-submodules=no \
+               origin refs/tags/bar &&
+       FOO_HASH=$(git -C server rev-parse foo) &&
+       ! grep "want $FOO_HASH" trace
+'
+
 # The following two tests must be in this order. It is important that
 # the srv.bare repository did not have tags during clone, but has tags
 # in the fetch.