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 <gitster@pobox.com> Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Ågren committed
Jan 3, 2021 at 10:36 UTC
04f6b0a192afad0b2f562deda8913417a875378e
1 file changed
+30
-30
t/t1300-config.sh
+30
-30
@@ -12,75 +12,75 @@ test_expect_success 'clear default config' '
12
'
13
14
cat > expect << EOF
15
-[core]
15
+[section]
16
penguin = little blue
17
EOF
18
test_expect_success 'initial' '
19
- git config core.penguin "little blue" &&
19
+ git config section.penguin "little blue" &&
20
test_cmp expect .git/config
21
'
22
23
cat > expect << EOF
24
-[core]
24
+[section]
25
penguin = little blue
26
Movie = BadPhysics
27
EOF
28
test_expect_success 'mixed case' '
29
- git config Core.Movie BadPhysics &&
29
+ git config Section.Movie BadPhysics &&
30
test_cmp expect .git/config
31
'
32
33
cat > expect << EOF
34
-[core]
34
+[section]
35
penguin = little blue
36
Movie = BadPhysics
37
-[Cores]
37
+[Sections]
38
WhatEver = Second
39
EOF
40
test_expect_success 'similar section' '
41
- git config Cores.WhatEver Second &&
41
+ git config Sections.WhatEver Second &&
42
test_cmp expect .git/config
43
'
44
45
cat > expect << EOF
46
-[core]
46
+[section]
47
penguin = little blue
48
Movie = BadPhysics
49
UPPERCASE = true
50
-[Cores]
50
+[Sections]
51
WhatEver = Second
52
EOF
53
test_expect_success 'uppercase section' '
54
- git config CORE.UPPERCASE true &&
54
+ git config SECTION.UPPERCASE true &&
55
test_cmp expect .git/config
56
'
57
58
test_expect_success 'replace with non-match' '
59
- git config core.penguin kingpin !blue
59
+ git config section.penguin kingpin !blue
60
'
61
62
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
64
'
65
66
cat > expect << EOF
67
-[core]
67
+[section]
68
penguin = very blue
69
Movie = BadPhysics
70
UPPERCASE = true
71
penguin = kingpin
72
-[Cores]
72
+[Sections]
73
WhatEver = Second
74
EOF
75
76
test_expect_success 'non-match result' 'test_cmp expect .git/config'
77
78
test_expect_success 'find mixed-case key by canonical name' '
79
- test_cmp_config Second cores.whatever
79
+ test_cmp_config Second sections.whatever
80
'
81
82
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
84
'
85
86
test_expect_success 'subsections are not canonicalized by git-config' '
@@ -1057,12 +1057,12 @@ test_expect_success 'git -c "key=value" support' '
1057
true
1058
EOF
1059
{
1060
- git -c core.name=value config core.name &&
1060
+ git -c section.name=value config section.name &&
1061
git -c foo.CamelCase=value config foo.camelcase &&
1062
git -c foo.flag config --bool foo.flag
1063
} >actual &&
1064
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
1066
'
1067
1068
# We just need a type-specifier here that cares about the
@@ -1107,7 +1107,7 @@ test_expect_success 'aliases can be CamelCased' '
1107
1108
test_expect_success 'git -c does not split values on equals' '
1109
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 &&
1111
test_cmp expect actual
1112
'
1113
@@ -1838,53 +1838,53 @@ do
1838
done
1839
1840
cat >.git/config <<-\EOF &&
1841
-[core]
1841
+[section]
1842
foo = true
1843
number = 10
1844
big = 1M
1845
EOF
1846
1847
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
1849
'
1850
1851
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
1853
'
1854
1855
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
1857
'
1858
1859
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 &&
1861
test_i18ngrep "only one type at a time" error
1862
'
1863
1864
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 &&
1866
test_i18ngrep "only one type at a time" error
1867
'
1868
1869
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 &&
1871
test_i18ngrep "only one type at a time" error
1872
'
1873
1874
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
1876
'
1877
1878
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
1880
'
1881
1882
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
1884
'
1885
1886
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 &&
1888
test_i18ngrep "unrecognized --type argument" error
1889
'
1890