]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5616-partial-clone.sh
read-tree + fetch tests: test failing "--super-prefix" interaction
[thirdparty/git.git] / t / t5616-partial-clone.sh
index 037941b95d2019f3c65b1b7fa39c03bfc343cd33..2846ec6629c1f9e29bb01ac65beccba413ecc4f4 100755 (executable)
@@ -644,6 +644,49 @@ test_expect_success 'repack does not loosen promisor objects' '
        grep "loosen_unused_packed_objects/loosened:0" trace
 '
 
+test_expect_failure 'lazy-fetch in submodule succeeds' '
+       # setup
+       test_config_global protocol.file.allow always &&
+
+       test_when_finished "rm -rf src-sub" &&
+       git init src-sub &&
+       git -C src-sub config uploadpack.allowfilter 1 &&
+       git -C src-sub config uploadpack.allowanysha1inwant 1 &&
+
+       # This blob must be missing in the subsequent commit.
+       echo foo >src-sub/file &&
+       git -C src-sub add file &&
+       git -C src-sub commit -m "submodule one" &&
+       SUB_ONE=$(git -C src-sub rev-parse HEAD) &&
+
+       echo bar >src-sub/file &&
+       git -C src-sub add file &&
+       git -C src-sub commit -m "submodule two" &&
+       SUB_TWO=$(git -C src-sub rev-parse HEAD) &&
+
+       test_when_finished "rm -rf src-super" &&
+       git init src-super &&
+       git -C src-super config uploadpack.allowfilter 1 &&
+       git -C src-super config uploadpack.allowanysha1inwant 1 &&
+       git -C src-super submodule add ../src-sub src-sub &&
+
+       git -C src-super/src-sub checkout $SUB_ONE &&
+       git -C src-super add src-sub &&
+       git -C src-super commit -m "superproject one" &&
+
+       git -C src-super/src-sub checkout $SUB_TWO &&
+       git -C src-super add src-sub &&
+       git -C src-super commit -m "superproject two" &&
+
+       # the fetch
+       test_when_finished "rm -rf client" &&
+       git clone --filter=blob:none --also-filter-submodules \
+               --recurse-submodules "file://$(pwd)/src-super" client &&
+
+       # Trigger lazy-fetch from the superproject
+       git -C client restore --recurse-submodules --source=HEAD^ :/
+'
+
 . "$TEST_DIRECTORY"/lib-httpd.sh
 start_httpd