Merge branch 'ps/tests-with-ref-files-backend'

Prepare existing tests on refs to work better with non-default
backends.

* ps/tests-with-ref-files-backend:
  t: mark tests regarding git-pack-refs(1) to be backend specific
  t5526: break test submodule differently
  t1419: mark test suite as files-backend specific
  t1302: make tests more robust with new extensions
  t1301: mark test for `core.sharedRepository` as reffiles specific
  t1300: make tests more robust with non-default ref backends
This commit is contained in:
Junio C Hamano 2024-02-06 14:31:21 -08:00
commit 46b5d75c08
6 changed files with 79 additions and 38 deletions

View file

@ -1098,15 +1098,20 @@ test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
test_must_fail git config --file=linktolinktonada --list
'
test_expect_success 'check split_cmdline return' "
git config alias.split-cmdline-fix 'echo \"' &&
test_expect_success 'check split_cmdline return' '
test_when_finished "rm -rf repo" &&
git init repo &&
(
cd repo &&
git config alias.split-cmdline-fix "echo \"" &&
test_must_fail git split-cmdline-fix &&
echo foo >foo &&
git add foo &&
git commit -m 'initial commit' &&
git config branch.main.mergeoptions 'echo \"' &&
git commit -m "initial commit" &&
git config branch.main.mergeoptions "echo \"" &&
test_must_fail git merge main
"
)
'
test_expect_success 'git -c "key=value" support' '
cat >expect <<-\EOF &&
@ -1157,10 +1162,16 @@ test_expect_success 'git -c works with aliases of builtins' '
'
test_expect_success 'aliases can be CamelCased' '
test_config alias.CamelCased "rev-parse HEAD" &&
test_when_finished "rm -rf repo" &&
git init repo &&
(
cd repo &&
test_commit A &&
git config alias.CamelCased "rev-parse HEAD" &&
git CamelCased >out &&
git rev-parse HEAD >expect &&
test_cmp expect out
)
'
test_expect_success 'git -c does not split values on equals' '
@ -2009,11 +2020,11 @@ test_expect_success '--show-origin getting a single key' '
'
test_expect_success 'set up custom config file' '
CUSTOM_CONFIG_FILE="custom.conf" &&
cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
cat >"custom.conf" <<-\EOF &&
[user]
custom = true
EOF
CUSTOM_CONFIG_FILE="$(test-tool path-utils real_path custom.conf)"
'
test_expect_success !MINGW 'set up custom config file with special name characters' '
@ -2052,22 +2063,33 @@ test_expect_success '--show-origin stdin with file include' '
'
test_expect_success '--show-origin blob' '
test_when_finished "rm -rf repo" &&
git init repo &&
(
cd repo &&
blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
cat >expect <<-EOF &&
blob:$blob user.custom=true
EOF
git config --blob=$blob --show-origin --list >output &&
test_cmp expect output
)
'
test_expect_success '--show-origin blob ref' '
test_when_finished "rm -rf repo" &&
git init repo &&
(
cd repo &&
cat >expect <<-\EOF &&
blob:main:custom.conf user.custom=true
EOF
git add "$CUSTOM_CONFIG_FILE" &&
cp "$CUSTOM_CONFIG_FILE" custom.conf &&
git add custom.conf &&
git commit -m "new config file" &&
git config --blob=main:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
git config --blob=main:custom.conf --show-origin --list >output &&
test_cmp expect output
)
'
test_expect_success '--show-origin with --default' '

View file

@ -137,7 +137,7 @@ test_expect_success POSIXPERM 'info/refs respects umask in unshared repo' '
test_cmp expect actual
'
test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' '
test_expect_success REFFILES,POSIXPERM 'git reflog expire honors core.sharedRepository' '
umask 077 &&
git config core.sharedRepository group &&
git reflog expire --all &&

View file

@ -9,10 +9,6 @@ TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
test_expect_success 'setup' '
test_oid_cache <<-\EOF &&
version sha1:0
version sha256:1
EOF
cat >test.patch <<-\EOF &&
diff --git a/test.txt b/test.txt
new file mode 100644
@ -28,7 +24,12 @@ test_expect_success 'setup' '
'
test_expect_success 'gitdir selection on normal repos' '
test_oid version >expect &&
if test_have_prereq DEFAULT_REPO_FORMAT
then
echo 0
else
echo 1
fi >expect &&
git config core.repositoryformatversion >actual &&
git -C test config core.repositoryformatversion >actual2 &&
test_cmp expect actual &&
@ -79,8 +80,13 @@ mkconfig () {
while read outcome version extensions; do
test_expect_success "$outcome version=$version $extensions" "
test_when_finished 'rm -rf extensions' &&
git init extensions &&
(
cd extensions &&
mkconfig $version $extensions >.git/config &&
check_${outcome}
)
"
done <<\EOF
allow 0
@ -94,7 +100,8 @@ allow 1 noop-v1
EOF
test_expect_success 'precious-objects allowed' '
mkconfig 1 preciousObjects >.git/config &&
git config core.repositoryFormatVersion 1 &&
git config extensions.preciousObjects 1 &&
check_allow
'

View file

@ -5,6 +5,12 @@ test_description='avoid rewriting packed-refs unnecessarily'
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test_have_prereq !REFFILES
then
skip_all='skipping files-backend specific pack-refs tests'
test_done
fi
# Add an identifying mark to the packed-refs file header line. This
# shouldn't upset readers, and it should be omitted if the file is
# ever rewritten.

View file

@ -8,6 +8,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
TEST_PASSES_SANITIZE_LEAK=true
. ./test-lib.sh
if test_have_prereq !REFFILES
then
skip_all='skipping `git for-each-ref --exclude` tests; need files backend'
test_done
fi
for_each_ref__exclude () {
GIT_TRACE2_PERF=1 test-tool ref-store main \
for-each-ref--exclude "$@" >actual.raw

View file

@ -771,7 +771,7 @@ test_expect_success 'fetching submodule into a broken repository' '
git -C dst fetch --recurse-submodules &&
# Break the receiving submodule
test-tool -C dst/sub ref-store main delete-refs REF_NO_DEREF msg HEAD &&
rm -r dst/sub/.git/objects &&
# NOTE: without the fix the following tests will recurse forever!
# They should terminate with an error.