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

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