tests: don't assume a .git/info for .git/info/sparse-checkout

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>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2022-06-03 13:15:09 +02:00
committed by Junio C Hamano
parent 1d758728fb
commit ead74601c6
6 changed files with 15 additions and 3 deletions

View File

@ -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 &&