tests: don't assume a .git/info for .git/info/attributes
Change those tests that assumed that a .git/info directory would be created for them when writing .git/info/attributes 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". The change here in here in t7814-grep-recurse-submodules.sh would continue "succeeding" with only the "TEST_CREATE_REPO_NO_TEMPLATE=1" part of this change. That's because those tests use "test_expect_failure", so they'd "pass" without this change, as "test_expect_failure" by design isn't discerning about what failure conditions it'll accept. But as we're fixing these sorts of issues across the test suite let's fix this one too. This issue was spotted with a local merge with another topic of mine[1], which introduces a stricter alternative to "test_expect_failure". 1. https://lore.kernel.org/git/cover-0.7-00000000000-20220318T002951Z-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
93e02b6e1e
commit
8da0b02d99
@ -3,6 +3,7 @@
|
||||
test_description=gitattributes
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
TEST_CREATE_REPO_NO_TEMPLATE=1
|
||||
. ./test-lib.sh
|
||||
|
||||
attr_check_basic () {
|
||||
@ -284,7 +285,7 @@ test_expect_success 'using --git-dir and --work-tree' '
|
||||
'
|
||||
|
||||
test_expect_success 'setup bare' '
|
||||
git clone --bare . bare.git
|
||||
git clone --template= --bare . bare.git
|
||||
'
|
||||
|
||||
test_expect_success 'bare repository: check that .gitattribute is ignored' '
|
||||
@ -315,6 +316,7 @@ test_expect_success 'bare repository: check that --cached honors index' '
|
||||
test_expect_success 'bare repository: test info/attributes' '
|
||||
(
|
||||
cd bare.git &&
|
||||
mkdir info &&
|
||||
(
|
||||
echo "f test=f" &&
|
||||
echo "a/i test=a/i"
|
||||
@ -360,6 +362,7 @@ test_expect_success SYMLINKS 'symlinks respected in core.attributesFile' '
|
||||
|
||||
test_expect_success SYMLINKS 'symlinks respected in info/attributes' '
|
||||
test_when_finished "rm .git/info/attributes" &&
|
||||
mkdir .git/info &&
|
||||
ln -s ../../attr .git/info/attributes &&
|
||||
attr_check file set
|
||||
'
|
||||
|
Reference in New Issue
Block a user