Skip to content

Commit 04f6b0a

Browse files
Martin Ågrengitster
authored andcommitted
t1300: don't needlessly work with core.foo configs
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 <[email protected]> Signed-off-by: Martin Ågren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34479d7 commit 04f6b0a

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

t/t1300-config.sh

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,75 +12,75 @@ test_expect_success 'clear default config' '
1212
'
1313

1414
cat > expect << EOF
15-
[core]
15+
[section]
1616
penguin = little blue
1717
EOF
1818
test_expect_success 'initial' '
19-
git config core.penguin "little blue" &&
19+
git config section.penguin "little blue" &&
2020
test_cmp expect .git/config
2121
'
2222

2323
cat > expect << EOF
24-
[core]
24+
[section]
2525
penguin = little blue
2626
Movie = BadPhysics
2727
EOF
2828
test_expect_success 'mixed case' '
29-
git config Core.Movie BadPhysics &&
29+
git config Section.Movie BadPhysics &&
3030
test_cmp expect .git/config
3131
'
3232

3333
cat > expect << EOF
34-
[core]
34+
[section]
3535
penguin = little blue
3636
Movie = BadPhysics
37-
[Cores]
37+
[Sections]
3838
WhatEver = Second
3939
EOF
4040
test_expect_success 'similar section' '
41-
git config Cores.WhatEver Second &&
41+
git config Sections.WhatEver Second &&
4242
test_cmp expect .git/config
4343
'
4444

4545
cat > expect << EOF
46-
[core]
46+
[section]
4747
penguin = little blue
4848
Movie = BadPhysics
4949
UPPERCASE = true
50-
[Cores]
50+
[Sections]
5151
WhatEver = Second
5252
EOF
5353
test_expect_success 'uppercase section' '
54-
git config CORE.UPPERCASE true &&
54+
git config SECTION.UPPERCASE true &&
5555
test_cmp expect .git/config
5656
'
5757

5858
test_expect_success 'replace with non-match' '
59-
git config core.penguin kingpin !blue
59+
git config section.penguin kingpin !blue
6060
'
6161

6262
test_expect_success 'replace with non-match (actually matching)' '
63-
git config core.penguin "very blue" !kingpin
63+
git config section.penguin "very blue" !kingpin
6464
'
6565

6666
cat > expect << EOF
67-
[core]
67+
[section]
6868
penguin = very blue
6969
Movie = BadPhysics
7070
UPPERCASE = true
7171
penguin = kingpin
72-
[Cores]
72+
[Sections]
7373
WhatEver = Second
7474
EOF
7575

7676
test_expect_success 'non-match result' 'test_cmp expect .git/config'
7777

7878
test_expect_success 'find mixed-case key by canonical name' '
79-
test_cmp_config Second cores.whatever
79+
test_cmp_config Second sections.whatever
8080
'
8181

8282
test_expect_success 'find mixed-case key by non-canonical name' '
83-
test_cmp_config Second CoReS.WhAtEvEr
83+
test_cmp_config Second SeCtIoNs.WhAtEvEr
8484
'
8585

8686
test_expect_success 'subsections are not canonicalized by git-config' '
@@ -1057,12 +1057,12 @@ test_expect_success 'git -c "key=value" support' '
10571057
true
10581058
EOF
10591059
{
1060-
git -c core.name=value config core.name &&
1060+
git -c section.name=value config section.name &&
10611061
git -c foo.CamelCase=value config foo.camelcase &&
10621062
git -c foo.flag config --bool foo.flag
10631063
} >actual &&
10641064
test_cmp expect actual &&
1065-
test_must_fail git -c name=value config core.name
1065+
test_must_fail git -c name=value config section.name
10661066
'
10671067

10681068
# We just need a type-specifier here that cares about the
@@ -1107,7 +1107,7 @@ test_expect_success 'aliases can be CamelCased' '
11071107

11081108
test_expect_success 'git -c does not split values on equals' '
11091109
echo "value with = in it" >expect &&
1110-
git -c core.foo="value with = in it" config core.foo >actual &&
1110+
git -c section.foo="value with = in it" config section.foo >actual &&
11111111
test_cmp expect actual
11121112
'
11131113

@@ -1838,53 +1838,53 @@ do
18381838
done
18391839

18401840
cat >.git/config <<-\EOF &&
1841-
[core]
1841+
[section]
18421842
foo = true
18431843
number = 10
18441844
big = 1M
18451845
EOF
18461846

18471847
test_expect_success 'identical modern --type specifiers are allowed' '
1848-
test_cmp_config 1048576 --type=int --type=int core.big
1848+
test_cmp_config 1048576 --type=int --type=int section.big
18491849
'
18501850

18511851
test_expect_success 'identical legacy --type specifiers are allowed' '
1852-
test_cmp_config 1048576 --int --int core.big
1852+
test_cmp_config 1048576 --int --int section.big
18531853
'
18541854

18551855
test_expect_success 'identical mixed --type specifiers are allowed' '
1856-
test_cmp_config 1048576 --int --type=int core.big
1856+
test_cmp_config 1048576 --int --type=int section.big
18571857
'
18581858

18591859
test_expect_success 'non-identical modern --type specifiers are not allowed' '
1860-
test_must_fail git config --type=int --type=bool core.big 2>error &&
1860+
test_must_fail git config --type=int --type=bool section.big 2>error &&
18611861
test_i18ngrep "only one type at a time" error
18621862
'
18631863

18641864
test_expect_success 'non-identical legacy --type specifiers are not allowed' '
1865-
test_must_fail git config --int --bool core.big 2>error &&
1865+
test_must_fail git config --int --bool section.big 2>error &&
18661866
test_i18ngrep "only one type at a time" error
18671867
'
18681868

18691869
test_expect_success 'non-identical mixed --type specifiers are not allowed' '
1870-
test_must_fail git config --type=int --bool core.big 2>error &&
1870+
test_must_fail git config --type=int --bool section.big 2>error &&
18711871
test_i18ngrep "only one type at a time" error
18721872
'
18731873

18741874
test_expect_success '--type allows valid type specifiers' '
1875-
test_cmp_config true --type=bool core.foo
1875+
test_cmp_config true --type=bool section.foo
18761876
'
18771877

18781878
test_expect_success '--no-type unsets type specifiers' '
1879-
test_cmp_config 10 --type=bool --no-type core.number
1879+
test_cmp_config 10 --type=bool --no-type section.number
18801880
'
18811881

18821882
test_expect_success 'unset type specifiers may be reset to conflicting ones' '
1883-
test_cmp_config 1048576 --type=bool --no-type --type=int core.big
1883+
test_cmp_config 1048576 --type=bool --no-type --type=int section.big
18841884
'
18851885

18861886
test_expect_success '--type rejects unknown specifiers' '
1887-
test_must_fail git config --type=nonsense core.foo 2>error &&
1887+
test_must_fail git config --type=nonsense section.foo 2>error &&
18881888
test_i18ngrep "unrecognized --type argument" error
18891889
'
18901890

0 commit comments

Comments
 (0)