Skip to content

Commit 5731e40

Browse files
committed
Merge branch 'ma/t1300-cleanup' into maint
Code clean-up. * ma/t1300-cleanup: t1300: don't needlessly work with `core.foo` configs t1300: remove duplicate test for `--file no-such-file` t1300: remove duplicate test for `--file ../foo`
2 parents 7734136 + 04f6b0a commit 5731e40

File tree

1 file changed

+32
-40
lines changed

1 file changed

+32
-40
lines changed

t/t1300-config.sh

Lines changed: 32 additions & 40 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' '
@@ -469,7 +469,8 @@ test_expect_success 'new variable inserts into proper section' '
469469
'
470470

471471
test_expect_success 'alternative --file (non-existing file should fail)' '
472-
test_must_fail git config --file non-existing-config -l
472+
test_must_fail git config --file non-existing-config -l &&
473+
test_must_fail git config --file non-existing-config test.xyzzy
473474
'
474475

475476
cat > other-config << EOF
@@ -506,10 +507,6 @@ test_expect_success 'editing stdin is an error' '
506507

507508
test_expect_success 'refer config from subdirectory' '
508509
mkdir x &&
509-
test_cmp_config -C x strasse --get --file ../other-config ein.bahn
510-
'
511-
512-
test_expect_success 'refer config from subdirectory via --file' '
513510
test_cmp_config -C x strasse --file=../other-config --get ein.bahn
514511
'
515512

@@ -1036,11 +1033,6 @@ test_expect_success SYMLINKS 'symlinked configuration' '
10361033
test_cmp expect actual
10371034
'
10381035

1039-
test_expect_success 'nonexistent configuration' '
1040-
test_must_fail git config --file=doesnotexist --list &&
1041-
test_must_fail git config --file=doesnotexist test.xyzzy
1042-
'
1043-
10441036
test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
10451037
ln -s doesnotexist linktonada &&
10461038
ln -s linktonada linktolinktonada &&
@@ -1065,12 +1057,12 @@ test_expect_success 'git -c "key=value" support' '
10651057
true
10661058
EOF
10671059
{
1068-
git -c core.name=value config core.name &&
1060+
git -c section.name=value config section.name &&
10691061
git -c foo.CamelCase=value config foo.camelcase &&
10701062
git -c foo.flag config --bool foo.flag
10711063
} >actual &&
10721064
test_cmp expect actual &&
1073-
test_must_fail git -c name=value config core.name
1065+
test_must_fail git -c name=value config section.name
10741066
'
10751067

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

11161108
test_expect_success 'git -c does not split values on equals' '
11171109
echo "value with = in it" >expect &&
1118-
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 &&
11191111
test_cmp expect actual
11201112
'
11211113

@@ -1846,53 +1838,53 @@ do
18461838
done
18471839

18481840
cat >.git/config <<-\EOF &&
1849-
[core]
1841+
[section]
18501842
foo = true
18511843
number = 10
18521844
big = 1M
18531845
EOF
18541846

18551847
test_expect_success 'identical modern --type specifiers are allowed' '
1856-
test_cmp_config 1048576 --type=int --type=int core.big
1848+
test_cmp_config 1048576 --type=int --type=int section.big
18571849
'
18581850

18591851
test_expect_success 'identical legacy --type specifiers are allowed' '
1860-
test_cmp_config 1048576 --int --int core.big
1852+
test_cmp_config 1048576 --int --int section.big
18611853
'
18621854

18631855
test_expect_success 'identical mixed --type specifiers are allowed' '
1864-
test_cmp_config 1048576 --int --type=int core.big
1856+
test_cmp_config 1048576 --int --type=int section.big
18651857
'
18661858

18671859
test_expect_success 'non-identical modern --type specifiers are not allowed' '
1868-
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 &&
18691861
test_i18ngrep "only one type at a time" error
18701862
'
18711863

18721864
test_expect_success 'non-identical legacy --type specifiers are not allowed' '
1873-
test_must_fail git config --int --bool core.big 2>error &&
1865+
test_must_fail git config --int --bool section.big 2>error &&
18741866
test_i18ngrep "only one type at a time" error
18751867
'
18761868

18771869
test_expect_success 'non-identical mixed --type specifiers are not allowed' '
1878-
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 &&
18791871
test_i18ngrep "only one type at a time" error
18801872
'
18811873

18821874
test_expect_success '--type allows valid type specifiers' '
1883-
test_cmp_config true --type=bool core.foo
1875+
test_cmp_config true --type=bool section.foo
18841876
'
18851877

18861878
test_expect_success '--no-type unsets type specifiers' '
1887-
test_cmp_config 10 --type=bool --no-type core.number
1879+
test_cmp_config 10 --type=bool --no-type section.number
18881880
'
18891881

18901882
test_expect_success 'unset type specifiers may be reset to conflicting ones' '
1891-
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
18921884
'
18931885

18941886
test_expect_success '--type rejects unknown specifiers' '
1895-
test_must_fail git config --type=nonsense core.foo 2>error &&
1887+
test_must_fail git config --type=nonsense section.foo 2>error &&
18961888
test_i18ngrep "unrecognized --type argument" error
18971889
'
18981890

0 commit comments

Comments
 (0)