]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: don't assume a .git/info for .git/info/sparse-checkout
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 3 Jun 2022 11:15:09 +0000 (13:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jun 2022 19:00:21 +0000 (12:00 -0700)
Change those tests that assumed that a .git/info directory would be
created for them when writing .git/info/sparse-checkout to explicitly
create the directory by setting "TEST_CREATE_REPO_NO_TEMPLATE=1"
before sourcing test-lib.sh, and using the "--template=" argument to
"git clone".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1011-read-tree-sparse-checkout.sh
t/t1090-sparse-checkout-scope.sh
t/t2018-checkout-branch.sh
t/t3507-cherry-pick-conflict.sh
t/t6435-merge-sparse.sh
t/t7418-submodule-sparse-gitmodules.sh

index dd957be1b78c5690fc79495f501eea52e4467600..c763fa7afa431a431915e033b6bbbe4d370df70b 100755 (executable)
@@ -11,6 +11,7 @@ test_description='sparse checkout tests
   A    init.t
 '
 
+TEST_CREATE_REPO_NO_TEMPLATE=1
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-read-tree.sh
 
@@ -53,6 +54,7 @@ test_expect_success 'read-tree without .git/info/sparse-checkout' '
 '
 
 test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
+       mkdir .git/info &&
        echo >.git/info/sparse-checkout &&
        read_tree_u_must_succeed -m -u HEAD &&
        git ls-files -t >result &&
index d1833c0f31b467e1dc5173a7332bfbb16c5de05c..3a14218b245d4cf67f9bdde4c18a7eee8ac6524a 100755 (executable)
@@ -5,6 +5,7 @@ test_description='sparse checkout scope tests'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_CREATE_REPO_NO_TEMPLATE=1
 . ./test-lib.sh
 
 test_expect_success 'setup' '
@@ -25,6 +26,7 @@ test_expect_success 'create feature branch' '
 
 test_expect_success 'perform sparse checkout of main' '
        git config --local --bool core.sparsecheckout true &&
+       mkdir .git/info &&
        echo "!/*" >.git/info/sparse-checkout &&
        echo "/a" >>.git/info/sparse-checkout &&
        echo "/c" >>.git/info/sparse-checkout &&
@@ -73,7 +75,7 @@ test_expect_success 'skip-worktree on files outside sparse patterns' '
 
 test_expect_success 'in partial clone, sparse checkout only fetches needed blobs' '
        test_create_repo server &&
-       git clone "file://$(pwd)/server" client &&
+       git clone --template= "file://$(pwd)/server" client &&
 
        test_config -C server uploadpack.allowfilter 1 &&
        test_config -C server uploadpack.allowanysha1inwant 1 &&
@@ -85,6 +87,7 @@ test_expect_success 'in partial clone, sparse checkout only fetches needed blobs
        git -C server commit -m message &&
 
        test_config -C client core.sparsecheckout 1 &&
+       mkdir client/.git/info &&
        echo "!/*" >client/.git/info/sparse-checkout &&
        echo "/a" >>client/.git/info/sparse-checkout &&
        git -C client fetch --filter=blob:none origin &&
index 52e51b0726f39c3e7ffbedad5a77484b8bec6070..771c3c3c50e60583e3ba8dffbb62f47a7619f35b 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='checkout'
 
+TEST_CREATE_REPO_NO_TEMPLATE=1
 . ./test-lib.sh
 
 # Arguments: [!] <branch> <oid> [<checkout options>]
@@ -257,11 +258,12 @@ test_expect_success 'checkout -b to a new branch preserves mergeable changes des
                git checkout branch1-scratch &&
                test_might_fail git branch -D branch3 &&
                git config core.sparseCheckout false &&
-               rm .git/info/sparse-checkout" &&
+               rm -rf .git/info" &&
 
        test_commit file2 &&
 
        echo stuff >>file1 &&
+       mkdir .git/info &&
        echo file2 >.git/info/sparse-checkout &&
        git config core.sparseCheckout true &&
 
index 979e843c65a97cf914e9f8f966893d2c965a9052..f32799e04633fd831293d5b64106f9c856d3d407 100755 (executable)
@@ -12,6 +12,7 @@ test_description='test cherry-pick and revert with conflicts
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_CREATE_REPO_NO_TEMPLATE=1
 . ./test-lib.sh
 
 pristine_detach () {
@@ -558,6 +559,7 @@ test_expect_success 'cherry-pick preserves sparse-checkout' '
                echo \"/*\" >.git/info/sparse-checkout
                git read-tree --reset -u HEAD
                rm .git/info/sparse-checkout" &&
+       mkdir .git/info &&
        echo /unrelated >.git/info/sparse-checkout &&
        git read-tree --reset -u HEAD &&
        test_must_fail git cherry-pick -Xours picked>actual &&
index 74562e1235666ffe49e0978b78dbfb06e416cd2e..fde4aa3cd1ab66a13c61234155da0c2bacb851a9 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='merge with sparse files'
 
+TEST_CREATE_REPO_NO_TEMPLATE=1
 . ./test-lib.sh
 
 # test_file $filename $content
@@ -26,6 +27,7 @@ test_expect_success 'setup' '
        git rm modify_delete &&
        test_commit_this ours &&
        git config core.sparseCheckout true &&
+       mkdir .git/info &&
        echo "/checked-out" >.git/info/sparse-checkout &&
        git reset --hard &&
        test_must_fail git merge theirs
index f87e524d6d467fd723c083c105f092850051f566..57d7ab3eced2970791021caa9855e1ed0c1d2712 100755 (executable)
@@ -31,8 +31,9 @@ test_expect_success 'sparse checkout setup which hides .gitmodules' '
                test_tick &&
                git commit -m "Add submodule"
        ) &&
-       git clone upstream super &&
+       git clone --template= upstream super &&
        (cd super &&
+               mkdir .git/info &&
                cat >.git/info/sparse-checkout <<-\EOF &&
                /*
                !/.gitmodules