From: Martin Ågren <hidden> Date: 2021-01-03 09:38:37
There was some discussion around t1300 a while back and how it could
need some major cleanup [1]. This patch series is not that. I'll post an
RFC series on that later. These initial cleanups -- or something like
them -- should be useful regardless of the fate of that future RFC, so
I'm posting them early.
[1] https://lore.kernel.org/git/xmqqlfeuqd8d.fsf@gitster.c.googlers.com/
Martin Ågren (3):
t1300: remove duplicate test for `--file ../foo`
t1300: remove duplicate test for `--file no-such-file`
t1300: don't needlessly work with `core.foo` configs
t/t1300-config.sh | 72 +++++++++++++++++++++--------------------------
1 file changed, 32 insertions(+), 40 deletions(-)
--
2.30.0
From: Martin Ågren <hidden> Date: 2021-01-03 09:38:38
We have two tests for checking that we can handle `git config --file
../other-config ...`. One, using `--file`, was introduced in 65807ee697
("builtin-config: Fix crash when using "-f <relative path>" from
non-root dir", 2010-01-26), then another, using `GIT_CONFIG`, came about
in 270a34438b ("config: stop using config_exclusive_filename",
2012-02-16).
The latter of these was then converted to use `--file` in f7e8714101
("t: prefer "git config --file" to GIT_CONFIG", 2014-03-20). Both where
then simplified in a5db0b77b9 ("t1300: extract and use
test_cmp_config()", 2018-10-21).
These two tests differ slightly in the order of the options used, but
other than that, they are identical. Let's drop one. As noted in
f7e8714101, we do still have a test for `GIT_CONFIG` and it shares the
implementation with `--file`.
Signed-off-by: Martin Ågren <redacted>
---
t/t1300-config.sh | 4 ----
1 file changed, 4 deletions(-)
@@ -506,10 +506,6 @@ test_expect_success 'editing stdin is an error' ' test_expect_success'refer config from subdirectory''mkdirx&&-test_cmp_config-Cxstrasse--get--file../other-configein.bahn-'--test_expect_success'refer config from subdirectory via --file''test_cmp_config-Cxstrasse--file=../other-config--getein.bahn'
From: Martin Ågren <hidden> Date: 2021-01-03 09:38:38
We test that we can handle `git config --file symlink` and the error
case of `git config --file symlink-to-missing-file`. For good measure,
we also throw in a test to check that we correctly handle referencing a
missing regular file. But we have such a test earlier in this script.
They both check that we fail to use `--file no-such-file --list`.
Drop the latter of these and keep the one that is in the general area
where we test `--file` and `GIT_CONFIG`. The one we're dropping also
checks that we can't even get a specific key from the missing file --
let's make sure we check that in the test we keep.
Signed-off-by: Martin Ågren <redacted>
---
t/t1300-config.sh | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
From: Martin Ågren <hidden> Date: 2021-01-03 09:39:05
We use various made-up config keys in the "core" section for no real
reason. Change them to work in the "section" section instead and be
careful to also change "cores" to "sections". Make sure to also catch
"Core", "CoReS" and similar.
There are a few instances that actually want to work with a real "core"
config such as `core.bare` or `core.editor`. After this, it's clearer
that they work with "core" for a reason.
Reported-by: Junio C Hamano <redacted>
Signed-off-by: Martin Ågren <redacted>
---
t/t1300-config.sh | 60 +++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
@@ -12,75 +12,75 @@ test_expect_success 'clear default config' '' cat>expect<<EOF-[core]+[section]penguin=littleblue EOF test_expect_success'initial''-gitconfigcore.penguin"little blue"&&+gitconfigsection.penguin"little blue"&&test_cmpexpect.git/config' cat>expect<<EOF-[core]+[section]penguin=littleblueMovie=BadPhysics EOF test_expect_success'mixed case''-gitconfigCore.MovieBadPhysics&&+gitconfigSection.MovieBadPhysics&&test_cmpexpect.git/config' cat>expect<<EOF-[core]+[section]penguin=littleblueMovie=BadPhysics-[Cores]+[Sections]WhatEver=Second EOF test_expect_success'similar section''-gitconfigCores.WhatEverSecond&&+gitconfigSections.WhatEverSecond&&test_cmpexpect.git/config' cat>expect<<EOF-[core]+[section]penguin=littleblueMovie=BadPhysicsUPPERCASE=true-[Cores]+[Sections]WhatEver=Second EOF test_expect_success'uppercase section''-gitconfigCORE.UPPERCASEtrue&&+gitconfigSECTION.UPPERCASEtrue&&test_cmpexpect.git/config' test_expect_success'replace with non-match''-gitconfigcore.penguinkingpin!blue+gitconfigsection.penguinkingpin!blue' test_expect_success'replace with non-match (actually matching)''-gitconfigcore.penguin"very blue"!kingpin+gitconfigsection.penguin"very blue"!kingpin' cat>expect<<EOF-[core]+[section]penguin=veryblueMovie=BadPhysicsUPPERCASE=truepenguin=kingpin-[Cores]+[Sections]WhatEver=Second EOF test_expect_success'non-match result''test_cmp expect .git/config' test_expect_success'find mixed-case key by canonical name''-test_cmp_configSecondcores.whatever+test_cmp_configSecondsections.whatever' test_expect_success'find mixed-case key by non-canonical name''-test_cmp_configSecondCoReS.WhAtEvEr+test_cmp_configSecondSeCtIoNs.WhAtEvEr' test_expect_success'subsections are not canonicalized by git-config''
@@ -1057,12 +1057,12 @@ test_expect_success 'git -c "key=value" support' 'trueEOF{-git-ccore.name=valueconfigcore.name&&+git-csection.name=valueconfigsection.name&&git-cfoo.CamelCase=valueconfigfoo.camelcase&&git-cfoo.flagconfig--boolfoo.flag}>actual&&test_cmpexpectactual&&-test_must_failgit-cname=valueconfigcore.name+test_must_failgit-cname=valueconfigsection.name'# We just need a type-specifier here that cares about the
@@ -1107,7 +1107,7 @@ test_expect_success 'aliases can be CamelCased' ' test_expect_success'git -c does not split values on equals''echo"value with = in it">expect&&-git-ccore.foo="value with = in it"configcore.foo>actual&&+git-csection.foo="value with = in it"configsection.foo>actual&&test_cmpexpectactual'
@@ -1838,53 +1838,53 @@ dodone cat>.git/config<<-\EOF&&-[core]+[section]foo=truenumber=10big=1M EOF test_expect_success'identical modern --type specifiers are allowed''-test_cmp_config1048576--type=int--type=intcore.big+test_cmp_config1048576--type=int--type=intsection.big' test_expect_success'identical legacy --type specifiers are allowed''-test_cmp_config1048576--int--intcore.big+test_cmp_config1048576--int--intsection.big' test_expect_success'identical mixed --type specifiers are allowed''-test_cmp_config1048576--int--type=intcore.big+test_cmp_config1048576--int--type=intsection.big' test_expect_success'non-identical modern --type specifiers are not allowed''-test_must_failgitconfig--type=int--type=boolcore.big2>error&&+test_must_failgitconfig--type=int--type=boolsection.big2>error&&test_i18ngrep"only one type at a time"error' test_expect_success'non-identical legacy --type specifiers are not allowed''-test_must_failgitconfig--int--boolcore.big2>error&&+test_must_failgitconfig--int--boolsection.big2>error&&test_i18ngrep"only one type at a time"error' test_expect_success'non-identical mixed --type specifiers are not allowed''-test_must_failgitconfig--type=int--boolcore.big2>error&&+test_must_failgitconfig--type=int--boolsection.big2>error&&test_i18ngrep"only one type at a time"error' test_expect_success'--type allows valid type specifiers''-test_cmp_configtrue--type=boolcore.foo+test_cmp_configtrue--type=boolsection.foo' test_expect_success'--no-type unsets type specifiers''-test_cmp_config10--type=bool--no-typecore.number+test_cmp_config10--type=bool--no-typesection.number' test_expect_success'unset type specifiers may be reset to conflicting ones''-test_cmp_config1048576--type=bool--no-type--type=intcore.big+test_cmp_config1048576--type=bool--no-type--type=intsection.big' test_expect_success'--type rejects unknown specifiers''-test_must_failgitconfig--type=nonsensecore.foo2>error&&+test_must_failgitconfig--type=nonsensesection.foo2>error&&test_i18ngrep"unrecognized --type argument"error'
From: Junio C Hamano <hidden> Date: 2021-01-06 06:06:22
Martin Ågren [off-list ref] writes:
There was some discussion around t1300 a while back and how it could
need some major cleanup [1]. This patch series is not that. I'll post an
RFC series on that later. These initial cleanups -- or something like
them -- should be useful regardless of the fate of that future RFC, so
I'm posting them early.
[1] https://lore.kernel.org/git/xmqqlfeuqd8d.fsf@gitster.c.googlers.com/
Martin Ågren (3):
t1300: remove duplicate test for `--file ../foo`
t1300: remove duplicate test for `--file no-such-file`
t1300: don't needlessly work with `core.foo` configs
t/t1300-config.sh | 72 +++++++++++++++++++++--------------------------
1 file changed, 32 insertions(+), 40 deletions(-)