git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Derrick Stolee" <derrickstolee@github.com>,
	"Adam Spiers" <git@adamspiers.org>, "Jeff King" <peff@peff.net>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Eric Sunshine" <sunshine@sunshineco.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 7/7] tests: don't assume a .git/info for .git/info/sparse-checkout
Date: Fri,  3 Jun 2022 13:15:09 +0200	[thread overview]
Message-ID: <patch-v2-7.7-0149c80f09c-20220603T110506Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v2-0.7-00000000000-20220603T110506Z-avarab@gmail.com>

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>
---
 t/t1011-read-tree-sparse-checkout.sh   | 2 ++
 t/t1090-sparse-checkout-scope.sh       | 5 ++++-
 t/t2018-checkout-branch.sh             | 4 +++-
 t/t3507-cherry-pick-conflict.sh        | 2 ++
 t/t6435-merge-sparse.sh                | 2 ++
 t/t7418-submodule-sparse-gitmodules.sh | 3 ++-
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index 63a553d7b32..742f0fa909f 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -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 &&
diff --git a/t/t1090-sparse-checkout-scope.sh b/t/t1090-sparse-checkout-scope.sh
index d1833c0f31b..3a14218b245 100755
--- a/t/t1090-sparse-checkout-scope.sh
+++ b/t/t1090-sparse-checkout-scope.sh
@@ -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 &&
diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 52e51b0726f..771c3c3c50e 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -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 &&
 
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 979e843c65a..f32799e0463 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -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 &&
diff --git a/t/t6435-merge-sparse.sh b/t/t6435-merge-sparse.sh
index 74562e12356..fde4aa3cd1a 100755
--- a/t/t6435-merge-sparse.sh
+++ b/t/t6435-merge-sparse.sh
@@ -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
diff --git a/t/t7418-submodule-sparse-gitmodules.sh b/t/t7418-submodule-sparse-gitmodules.sh
index f87e524d6d4..57d7ab3eced 100755
--- a/t/t7418-submodule-sparse-gitmodules.sh
+++ b/t/t7418-submodule-sparse-gitmodules.sh
@@ -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
-- 
2.36.1.1119.g5a713b43bd4


  parent reply	other threads:[~2022-06-03 11:16 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 20:13 [PATCH 00/13] tests + init: don't rely on templates & add --no-template + config Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 01/13] t0001: fix gaps in "TEMPLATE DIRECTORY" coverage Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 02/13] init: split out template population from create_default_files() Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 03/13] init: unconditionally create the "info" directory Ævar Arnfjörð Bjarmason
2021-12-20 15:59   ` Derrick Stolee
2021-12-20 16:13     ` Ævar Arnfjörð Bjarmason
2021-12-20 17:39       ` Derrick Stolee
2021-12-20 18:16         ` Ævar Arnfjörð Bjarmason
2021-12-20 19:06         ` Junio C Hamano
2021-12-21  1:15           ` Ævar Arnfjörð Bjarmason
2021-12-21  2:10             ` Junio C Hamano
2021-12-21  2:39               ` Ævar Arnfjörð Bjarmason
2021-12-21  6:38                 ` Junio C Hamano
2021-12-24 17:26                   ` Ævar Arnfjörð Bjarmason
2021-12-25  1:58                     ` Junio C Hamano
2022-01-12 12:42         ` Ævar Arnfjörð Bjarmason
2022-01-18 19:43           ` Derrick Stolee
2022-01-19  1:00             ` Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 04/13] t0008: don't rely on default ".git/info/exclude" Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 05/13] init & clone: add a --no-template option Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 06/13] init & clone: add init.templateDir=[bool] Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 07/13] test-lib: create test data with "git init --no-template" (almost) Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 08/13] tests: don't depend on template-created .git/branches Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 09/13] t5540: don't rely on "hook/post-update.sample" Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 10/13] test-lib-functions: add and use a "write_hook" wrapper Ævar Arnfjörð Bjarmason
2021-12-13 14:15   ` Eric Sunshine
2021-12-13 16:29     ` Ævar Arnfjörð Bjarmason
2021-12-13 16:45       ` Eric Sunshine
2021-12-13 19:37         ` Ævar Arnfjörð Bjarmason
2021-12-13 21:33           ` Eric Sunshine
2021-12-12 20:13 ` [PATCH 11/13] tests: change "cat && chmod +x" to use "write_hook" Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 12/13] tests: migrate miscellaneous "write_script" to "write_hooks" Ævar Arnfjörð Bjarmason
2021-12-12 20:13 ` [PATCH 13/13] tests: don't depend on template-created .git/hooks Ævar Arnfjörð Bjarmason
2022-06-03 11:15 ` [PATCH v2 0/7] tests: don't depend on "git init" using the template Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` [PATCH v2 1/7] t0008: don't rely on default ".git/info/exclude" Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` [PATCH v2 2/7] tests: don't depend on template-created .git/branches Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` [PATCH v2 3/7] tests: don't assume a .git/info for .git/info/grafts Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` [PATCH v2 4/7] tests: don't assume a .git/info for .git/info/attributes Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` [PATCH v2 5/7] tests: don't assume a .git/info for .git/info/refs Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` [PATCH v2 6/7] tests: don't assume a .git/info for .git/info/exclude Ævar Arnfjörð Bjarmason
2022-06-03 11:15   ` Ævar Arnfjörð Bjarmason [this message]
2022-06-03 19:17   ` [PATCH v2 0/7] tests: don't depend on "git init" using the template Junio C Hamano
2022-06-04  0:41     ` Ævar Arnfjörð Bjarmason
2022-06-06 19:08       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=patch-v2-7.7-0149c80f09c-20220603T110506Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=derrickstolee@github.com \
    --cc=git@adamspiers.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).