76
76
test_expect_success ' non-match result' ' test_cmp expect .git/config'
77
77
78
78
test_expect_success ' find mixed-case key by canonical name' '
79
- echo Second >expect &&
80
- git config cores.whatever >actual &&
81
- test_cmp expect actual
79
+ test_cmp_config Second cores.whatever
82
80
'
83
81
84
82
test_expect_success ' find mixed-case key by non-canonical name' '
85
- echo Second >expect &&
86
- git config CoReS.WhAtEvEr >actual &&
87
- test_cmp expect actual
83
+ test_cmp_config Second CoReS.WhAtEvEr
88
84
'
89
85
90
86
test_expect_success ' subsections are not canonicalized by git-config' '
@@ -94,12 +90,8 @@ test_expect_success 'subsections are not canonicalized by git-config' '
94
90
[section "SubSection"]
95
91
key = two
96
92
EOF
97
- echo one >expect &&
98
- git config section.subsection.key >actual &&
99
- test_cmp expect actual &&
100
- echo two >expect &&
101
- git config section.SubSection.key >actual &&
102
- test_cmp expect actual
93
+ test_cmp_config one section.subsection.key &&
94
+ test_cmp_config two section.SubSection.key
103
95
'
104
96
105
97
cat > .git/config << \EOF
@@ -212,9 +204,7 @@ test_expect_success 'really really mean test' '
212
204
'
213
205
214
206
test_expect_success ' get value' '
215
- echo alpha >expect &&
216
- git config beta.haha >actual &&
217
- test_cmp expect actual
207
+ test_cmp_config alpha beta.haha
218
208
'
219
209
220
210
cat > expect << EOF
@@ -251,15 +241,11 @@ test_expect_success 'non-match' '
251
241
'
252
242
253
243
test_expect_success ' non-match value' '
254
- echo wow >expect &&
255
- git config --get nextsection.nonewline !for >actual &&
256
- test_cmp expect actual
244
+ test_cmp_config wow --get nextsection.nonewline !for
257
245
'
258
246
259
247
test_expect_success ' multi-valued get returns final one' '
260
- echo "wow2 for me" >expect &&
261
- git config --get nextsection.nonewline >actual &&
262
- test_cmp expect actual
248
+ test_cmp_config "wow2 for me" --get nextsection.nonewline
263
249
'
264
250
265
251
test_expect_success ' multi-valued get-all returns all' '
@@ -520,21 +506,11 @@ test_expect_success 'editing stdin is an error' '
520
506
521
507
test_expect_success ' refer config from subdirectory' '
522
508
mkdir x &&
523
- (
524
- cd x &&
525
- echo strasse >expect &&
526
- git config --get --file ../other-config ein.bahn >actual &&
527
- test_cmp expect actual
528
- )
529
-
509
+ test_cmp_config -C x strasse --get --file ../other-config ein.bahn
530
510
'
531
511
532
512
test_expect_success ' refer config from subdirectory via --file' '
533
- (
534
- cd x &&
535
- git config --file=../other-config --get ein.bahn >actual &&
536
- test_cmp expect actual
537
- )
513
+ test_cmp_config -C x strasse --file=../other-config --get ein.bahn
538
514
'
539
515
540
516
cat > expect << EOF
@@ -688,16 +664,13 @@ test_expect_success numbers '
688
664
689
665
test_expect_success ' --int is at least 64 bits' '
690
666
git config giga.watts 121g &&
691
- echo 129922760704 >expect &&
692
- git config --int --get giga.watts >actual &&
693
- test_cmp expect actual
667
+ echo >expect &&
668
+ test_cmp_config 129922760704 --int --get giga.watts
694
669
'
695
670
696
671
test_expect_success ' invalid unit' '
697
672
git config aninvalid.unit "1auto" &&
698
- echo 1auto >expect &&
699
- git config aninvalid.unit >actual &&
700
- test_cmp expect actual &&
673
+ test_cmp_config 1auto aninvalid.unit &&
701
674
test_must_fail git config --int --get aninvalid.unit 2>actual &&
702
675
test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
703
676
'
@@ -1039,9 +1012,7 @@ test_expect_success '--null --get-regexp' '
1039
1012
1040
1013
test_expect_success ' inner whitespace kept verbatim' '
1041
1014
git config section.val "foo bar" &&
1042
- echo "foo bar" >expect &&
1043
- git config section.val >actual &&
1044
- test_cmp expect actual
1015
+ test_cmp_config "foo bar" section.val
1045
1016
'
1046
1017
1047
1018
test_expect_success SYMLINKS ' symlinked configuration' '
@@ -1809,21 +1780,15 @@ big = 1M
1809
1780
EOF
1810
1781
1811
1782
test_expect_success ' identical modern --type specifiers are allowed' '
1812
- git config --type=int --type=int core.big >actual &&
1813
- echo 1048576 >expect &&
1814
- test_cmp expect actual
1783
+ test_cmp_config 1048576 --type=int --type=int core.big
1815
1784
'
1816
1785
1817
1786
test_expect_success ' identical legacy --type specifiers are allowed' '
1818
- git config --int --int core.big >actual &&
1819
- echo 1048576 >expect &&
1820
- test_cmp expect actual
1787
+ test_cmp_config 1048576 --int --int core.big
1821
1788
'
1822
1789
1823
1790
test_expect_success ' identical mixed --type specifiers are allowed' '
1824
- git config --int --type=int core.big >actual &&
1825
- echo 1048576 >expect &&
1826
- test_cmp expect actual
1791
+ test_cmp_config 1048576 --int --type=int core.big
1827
1792
'
1828
1793
1829
1794
test_expect_success ' non-identical modern --type specifiers are not allowed' '
@@ -1842,21 +1807,15 @@ test_expect_success 'non-identical mixed --type specifiers are not allowed' '
1842
1807
'
1843
1808
1844
1809
test_expect_success ' --type allows valid type specifiers' '
1845
- echo "true" >expect &&
1846
- git config --type=bool core.foo >actual &&
1847
- test_cmp expect actual
1810
+ test_cmp_config true --type=bool core.foo
1848
1811
'
1849
1812
1850
1813
test_expect_success ' --no-type unsets type specifiers' '
1851
- echo "10" >expect &&
1852
- git config --type=bool --no-type core.number >actual &&
1853
- test_cmp expect actual
1814
+ test_cmp_config 10 --type=bool --no-type core.number
1854
1815
'
1855
1816
1856
1817
test_expect_success ' unset type specifiers may be reset to conflicting ones' '
1857
- echo 1048576 >expect &&
1858
- git config --type=bool --no-type --type=int core.big >actual &&
1859
- test_cmp expect actual
1818
+ test_cmp_config 1048576 --type=bool --no-type --type=int core.big
1860
1819
'
1861
1820
1862
1821
test_expect_success ' --type rejects unknown specifiers' '
0 commit comments