3 # Copyright (c) 2005 Johannes Schindelin
6 test_description
='Test git config in different settings'
8 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13 test_expect_success
'clear default config' '
21 test_expect_success
'initial' '
22 git config section.penguin "little blue" &&
23 test_cmp expect .git/config
31 test_expect_success
'mixed case' '
32 git config Section.Movie BadPhysics &&
33 test_cmp expect .git/config
43 test_expect_success
'similar section' '
44 git config Sections.WhatEver Second &&
45 test_cmp expect .git/config
56 test_expect_success
'uppercase section' '
57 git config SECTION.UPPERCASE true &&
58 test_cmp expect .git/config
61 test_expect_success
'replace with non-match' '
62 git config section.penguin kingpin !blue
65 test_expect_success
'replace with non-match (actually matching)' '
66 git config section.penguin "very blue" !kingpin
79 test_expect_success
'non-match result' 'test_cmp expect .git/config'
81 test_expect_success
'find mixed-case key by canonical name' '
82 test_cmp_config Second sections.whatever
85 test_expect_success
'find mixed-case key by non-canonical name' '
86 test_cmp_config Second SeCtIoNs.WhAtEvEr
89 test_expect_success
'subsections are not canonicalized by git-config' '
90 cat >>.git/config <<-\EOF &&
93 [section "SubSection"]
96 test_cmp_config one section.subsection.key &&
97 test_cmp_config two section.SubSection.key
100 cat > .git
/config
<<\EOF
109 test_expect_success
'unset with cont. lines' '
110 git config --unset beta.baz
120 test_expect_success
'unset with cont. lines is correct' 'test_cmp expect .git/config'
122 cat > .git
/config
<< EOF
123 [beta] ; silly comment # another comment
124 noIndent= sillyValue ; 'nother silly comment
128 haha ="beta" # last silly comment
131 [nextSection] noNewline = ouch
134 cp .git
/config .git
/config2
136 test_expect_success
'multiple unset' '
137 git config --unset-all beta.haha
141 [beta] ; silly comment # another comment
142 noIndent= sillyValue ; 'nother silly comment
146 [nextSection] noNewline = ouch
149 test_expect_success
'multiple unset is correct' '
150 test_cmp expect .git/config
153 cp .git
/config2 .git
/config
155 test_expect_success
'--replace-all missing value' '
156 test_must_fail git config --replace-all beta.haha &&
157 test_cmp .git/config2 .git/config
162 test_expect_success
'--replace-all' '
163 git config --replace-all beta.haha gamma
167 [beta] ; silly comment # another comment
168 noIndent= sillyValue ; 'nother silly comment
173 [nextSection] noNewline = ouch
176 test_expect_success
'all replaced' '
177 test_cmp expect .git/config
181 [beta] ; silly comment # another comment
182 noIndent= sillyValue ; 'nother silly comment
187 [nextSection] noNewline = ouch
189 test_expect_success
'really mean test' '
190 git config beta.haha alpha &&
191 test_cmp expect .git/config
195 [beta] ; silly comment # another comment
196 noIndent= sillyValue ; 'nother silly comment
204 test_expect_success
'really really mean test' '
205 git config nextsection.nonewline wow &&
206 test_cmp expect .git/config
209 test_expect_success
'get value' '
210 test_cmp_config alpha beta.haha
214 [beta] ; silly comment # another comment
215 noIndent= sillyValue ; 'nother silly comment
222 test_expect_success
'unset' '
223 git config --unset beta.haha &&
224 test_cmp expect .git/config
228 [beta] ; silly comment # another comment
229 noIndent= sillyValue ; 'nother silly comment
235 NoNewLine = wow2 for me
237 test_expect_success
'multivar' '
238 git config nextsection.NoNewLine "wow2 for me" "for me$" &&
239 test_cmp expect .git/config
242 test_expect_success
'non-match' '
243 git config --get nextsection.nonewline !for
246 test_expect_success
'non-match value' '
247 test_cmp_config wow --get nextsection.nonewline !for
250 test_expect_success
'multi-valued get returns final one' '
251 test_cmp_config "wow2 for me" --get nextsection.nonewline
254 test_expect_success
'multi-valued get-all returns all' '
255 cat >expect <<-\EOF &&
259 git config --get-all nextsection.nonewline >actual &&
260 test_cmp expect actual
264 [beta] ; silly comment # another comment
265 noIndent= sillyValue ; 'nother silly comment
271 NoNewLine = wow2 for me
273 test_expect_success
'multivar replace' '
274 git config nextsection.nonewline "wow3" "wow$" &&
275 test_cmp expect .git/config
278 test_expect_success
'ambiguous unset' '
279 test_must_fail git config --unset nextsection.nonewline
282 test_expect_success
'invalid unset' '
283 test_must_fail git config --unset somesection.nonewline
287 [beta] ; silly comment # another comment
288 noIndent= sillyValue ; 'nother silly comment
293 NoNewLine = wow2 for me
296 test_expect_success
'multivar unset' '
297 git config --unset nextsection.nonewline "wow3$" &&
298 test_cmp expect .git/config
301 test_expect_success
'invalid key' 'test_must_fail git config inval.2key blabla'
303 test_expect_success
'correct key' 'git config 123456.a123 987'
305 test_expect_success
'hierarchical section' '
306 git config Version.1.2.3eX.Alpha beta
310 [beta] ; silly comment # another comment
311 noIndent= sillyValue ; 'nother silly comment
316 NoNewLine = wow2 for me
323 test_expect_success
'hierarchical section value' '
324 test_cmp expect .git/config
328 beta.noindent=sillyValue
329 nextsection.nonewline=wow2 for me
331 version.1.2.3eX.alpha=beta
334 test_expect_success
'working --list' '
335 git config --list > output &&
336 test_cmp expect output
338 test_expect_success
'--list without repo produces empty output' '
339 git --git-dir=nonexistent config --list >output &&
340 test_must_be_empty output
345 nextsection.nonewline
347 version.1.2.3eX.alpha
350 test_expect_success
'--name-only --list' '
351 git config --name-only --list >output &&
352 test_cmp expect output
356 beta.noindent sillyValue
357 nextsection.nonewline wow2 for me
360 test_expect_success
'--get-regexp' '
361 git config --get-regexp in >output &&
362 test_cmp expect output
367 nextsection.nonewline
370 test_expect_success
'--name-only --get-regexp' '
371 git config --name-only --get-regexp in >output &&
372 test_cmp expect output
380 test_expect_success
'--add' '
381 git config --add nextsection.nonewline "wow4 for you" &&
382 git config --get-all nextsection.nonewline > output &&
383 test_cmp expect output
386 cat > .git
/config
<< EOF
393 test_expect_success
'get variable with no value' '
394 git config --get novalue.variable ^$
397 test_expect_success
'get variable with empty value' '
398 git config --get emptyvalue.variable ^$
401 echo novalue.variable
> expect
403 test_expect_success
'get-regexp variable with no value' '
404 git config --get-regexp novalue > output &&
405 test_cmp expect output
408 echo 'novalue.variable true' > expect
410 test_expect_success
'get-regexp --bool variable with no value' '
411 git config --bool --get-regexp novalue > output &&
412 test_cmp expect output
415 echo 'emptyvalue.variable ' > expect
417 test_expect_success
'get-regexp variable with empty value' '
418 git config --get-regexp emptyvalue > output &&
419 test_cmp expect output
424 test_expect_success
'get bool variable with no value' '
425 git config --bool novalue.variable > output &&
426 test_cmp expect output
431 test_expect_success
'get bool variable with empty value' '
432 git config --bool emptyvalue.variable > output &&
433 test_cmp expect output
436 test_expect_success
'no arguments, but no crash' '
437 test_must_fail git config >output 2>&1 &&
438 test_i18ngrep usage output
441 cat > .git
/config
<< EOF
453 test_expect_success
'new section is partial match of another' '
455 test_cmp expect .git/config
468 test_expect_success
'new variable inserts into proper section' '
471 test_cmp expect .git/config
474 test_expect_success
'alternative --file (non-existing file should fail)' '
475 test_must_fail git config --file non-existing-config -l &&
476 test_must_fail git config --file non-existing-config test.xyzzy
479 cat > other-config
<< EOF
488 test_expect_success
'alternative GIT_CONFIG' '
489 GIT_CONFIG=other-config git config --list >output &&
490 test_cmp expect output
493 test_expect_success
'alternative GIT_CONFIG (--file)' '
494 git config --file other-config --list >output &&
495 test_cmp expect output
498 test_expect_success
'alternative GIT_CONFIG (--file=-)' '
499 git config --file - --list <other-config >output &&
500 test_cmp expect output
503 test_expect_success
'setting a value in stdin is an error' '
504 test_must_fail git config --file - some.value foo
507 test_expect_success
'editing stdin is an error' '
508 test_must_fail git config --file - --edit
511 test_expect_success
'refer config from subdirectory' '
513 test_cmp_config -C x strasse --file=../other-config --get ein.bahn
523 test_expect_success
'--set in alternative file' '
524 git config --file=other-config anwohner.park ausweis &&
525 test_cmp expect other-config
528 cat > .git
/config
<< EOF
535 [branch "1 234 blabl/a"]
539 test_expect_success
'rename section' '
540 git config --rename-section branch.eins branch.zwei
550 [branch "1 234 blabl/a"]
554 test_expect_success
'rename succeeded' '
555 test_cmp expect .git/config
558 test_expect_success
'rename non-existing section' '
559 test_must_fail git config --rename-section \
560 branch."world domination" branch.drei
563 test_expect_success
'rename succeeded' '
564 test_cmp expect .git/config
567 test_expect_success
'rename another section' '
568 git config --rename-section branch."1 234 blabl/a" branch.drei
582 test_expect_success
'rename succeeded' '
583 test_cmp expect .git/config
586 cat >> .git
/config
<< EOF
587 [branch "vier"] z = 1
590 test_expect_success
'rename a section with a var on the same line' '
591 git config --rename-section branch.vier branch.zwei
607 test_expect_success
'rename succeeded' '
608 test_cmp expect .git/config
611 test_expect_success
'renaming empty section name is rejected' '
612 test_must_fail git config --rename-section branch.zwei ""
615 test_expect_success
'renaming to bogus section is rejected' '
616 test_must_fail git config --rename-section branch.zwei "bogus name"
619 cat >> .git
/config
<< EOF
620 [branch "zwei"] a = 1 [branch "vier"]
623 test_expect_success
'remove section' '
624 git config --remove-section branch.zwei
634 test_expect_success
'section was removed properly' '
635 test_cmp expect .git/config
641 dbname = %Ggitcvs2.%a.%m.sqlite
643 dbname = %Ggitcvs1.%a.%m.sqlite
646 test_expect_success
'section ending' '
648 git config gitcvs.enabled true &&
649 git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
650 git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
651 test_cmp expect .git/config
655 test_expect_success numbers
'
656 git config kilo.gram 1k &&
657 git config mega.ton 1m &&
659 echo 1048576 >>expect &&
660 git config --int --get kilo.gram >actual &&
661 git config --int --get mega.ton >>actual &&
662 test_cmp expect actual
665 test_expect_success
'--int is at least 64 bits' '
666 git config giga.watts 121g &&
668 test_cmp_config 129922760704 --int --get giga.watts
671 test_expect_success
'invalid unit' '
672 git config aninvalid.unit "1auto" &&
673 test_cmp_config 1auto aninvalid.unit &&
674 test_must_fail git config --int --get aninvalid.unit 2>actual &&
675 test_i18ngrep "bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit" actual
678 test_expect_success
'line number is reported correctly' '
679 printf "[bool]\n\tvar\n" >invalid &&
680 test_must_fail git config -f invalid --path bool.var 2>actual &&
681 test_i18ngrep "line 2" actual
684 test_expect_success
'invalid stdin config' '
685 echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
686 test_i18ngrep "bad config line 1 in standard input" output
700 test_expect_success bool
'
702 git config bool.true1 01 &&
703 git config bool.true2 -1 &&
704 git config bool.true3 YeS &&
705 git config bool.true4 true &&
706 git config bool.false1 000 &&
707 git config bool.false2 "" &&
708 git config bool.false3 nO &&
709 git config bool.false4 FALSE &&
713 git config --bool --get bool.true$i >>result
714 git config --bool --get bool.false$i >>result
716 test_cmp expect result'
718 test_expect_success
'invalid bool (--get)' '
720 git config bool.nobool foobar &&
721 test_must_fail git config --bool --get bool.nobool'
723 test_expect_success
'invalid bool (set)' '
725 test_must_fail git config --bool bool.nobool foobar'
739 test_expect_success
'set --bool' '
742 git config --bool bool.true1 01 &&
743 git config --bool bool.true2 -1 &&
744 git config --bool bool.true3 YeS &&
745 git config --bool bool.true4 true &&
746 git config --bool bool.false1 000 &&
747 git config --bool bool.false2 "" &&
748 git config --bool bool.false3 nO &&
749 git config --bool bool.false4 FALSE &&
750 test_cmp expect .git/config'
759 test_expect_success
'set --int' '
762 git config --int int.val1 01 &&
763 git config --int int.val2 -1 &&
764 git config --int int.val3 5m &&
765 test_cmp expect .git/config
768 test_expect_success
'get --bool-or-int' '
769 cat >.git/config <<-\EOF &&
779 cat >expect <<-\EOF &&
788 git config --bool-or-int bool.true1 &&
789 git config --bool-or-int bool.true2 &&
790 git config --bool-or-int bool.false &&
791 git config --bool-or-int int.int1 &&
792 git config --bool-or-int int.int2 &&
793 git config --bool-or-int int.int3
795 test_cmp expect actual
810 test_expect_success
'set --bool-or-int' '
812 git config --bool-or-int bool.true1 true &&
813 git config --bool-or-int bool.false1 false &&
814 git config --bool-or-int bool.true2 yes &&
815 git config --bool-or-int bool.false2 no &&
816 git config --bool-or-int int.int1 0 &&
817 git config --bool-or-int int.int2 1 &&
818 git config --bool-or-int int.int3 -1 &&
819 test_cmp expect .git/config
829 test_expect_success
!MINGW
'set --path' '
831 git config --path path.home "~/" &&
832 git config --path path.normal "/dev/null" &&
833 git config --path path.trailingtilde "foo~" &&
834 test_cmp expect .git/config'
836 if test_have_prereq
!MINGW
&& test "${HOME+set}"
838 test_set_prereq HOMEVAR
847 test_expect_success HOMEVAR
'get --path' '
848 git config --get --path path.home > result &&
849 git config --get --path path.normal >> result &&
850 git config --get --path path.trailingtilde >> result &&
851 test_cmp expect result
859 test_expect_success
!MINGW
'get --path copes with unset $HOME' '
862 test_must_fail git config --get --path path.home \
864 git config --get --path path.normal >>result &&
865 git config --get --path path.trailingtilde >>result
867 test_i18ngrep "[Ff]ailed to expand.*~/" msg &&
868 test_cmp expect result
871 test_expect_success
'get --path barfs on boolean variable' '
872 echo "[path]bool" >.git/config &&
873 test_must_fail git config --get --path path.bool
876 test_expect_success
'get --expiry-date' '
877 rel="3.weeks.5.days.00:00" &&
879 cat >.git/config <<-\EOF &&
881 valid1 = "3.weeks.5.days 00:00"
882 valid2 = "Fri Jun 4 15:46:55 2010"
883 valid3 = "2017/11/11 11:11:11PM"
884 valid4 = "2017/11/10 09:08:07 PM"
888 cat >expect <<-EOF &&
889 $(test-tool date timestamp $rel)
895 : "work around heredoc parsing bug fixed in dash 0.5.7 (in ec2c84d)" &&
897 echo "$rel_out $(git config --expiry-date date.valid1)"
898 git config --expiry-date date.valid2 &&
899 git config --expiry-date date.valid3 &&
900 git config --expiry-date date.valid4 &&
901 git config --expiry-date date.valid5
903 test_cmp expect actual &&
904 test_must_fail git config --expiry-date date.invalid1
907 test_expect_success
'get --type=color' '
909 git config foo.color "red" &&
910 git config --get --type=color foo.color >actual.raw &&
911 test_decode_color <actual.raw >actual &&
912 echo "<RED>" >expect &&
913 test_cmp expect actual
921 test_expect_success
'set --type=color' '
923 git config --type=color foo.color "red" &&
924 test_cmp expect .git/config
927 test_expect_success
'get --type=color barfs on non-color' '
928 echo "[foo]bar=not-a-color" >.git/config &&
929 test_must_fail git config --get --type=color foo.bar
932 test_expect_success
'set --type=color barfs on non-color' '
933 test_must_fail git config --type=color foo.color "not-a-color" 2>error &&
934 test_i18ngrep "cannot parse color" error
941 semicolon = "test;test"
944 test_expect_success
'quoting' '
946 git config quote.leading " test" &&
947 git config quote.ending "test " &&
948 git config quote.semicolon "test;test" &&
949 git config quote.hash "test#test" &&
950 test_cmp expect .git/config
953 test_expect_success
'key with newline' '
954 test_must_fail git config "key.with
957 test_expect_success
'value with newline' 'git config key.sub value.with\\\
960 cat > .git
/config
<<\EOF
965 noncont
= not continued
; \
971 section.continued
=continued
972 section.noncont
=not continued
973 section.quotecont
=cont
;inued
976 test_expect_success
'value continued on next line' '
977 git config --list > result &&
978 test_cmp expect result
981 cat > .git
/config
<<\EOF
982 [section
"sub=section"]
991 section.sub
=section.val1
992 foo
=barQsection.sub
=section.val2
994 barQsection.sub
=section.val3
997 Qsection.sub
=section.val4
998 Qsection.sub
=section.val5Q
1000 test_expect_success
'--null --list' '
1001 git config --null --list >result.raw &&
1002 nul_to_q <result.raw >result &&
1004 test_cmp expect result
1007 test_expect_success
'--null --get-regexp' '
1008 git config --null --get-regexp "val[0-9]" >result.raw &&
1009 nul_to_q <result.raw >result &&
1011 test_cmp expect result
1014 test_expect_success
'inner whitespace kept verbatim' '
1015 git config section.val "foo bar" &&
1016 test_cmp_config "foo bar" section.val
1019 test_expect_success SYMLINKS
'symlinked configuration' '
1020 ln -s notyet myconfig &&
1021 git config --file=myconfig test.frotz nitfol &&
1024 test "z$(git config --file=notyet test.frotz)" = znitfol &&
1025 git config --file=myconfig test.xyzzy rezrov &&
1028 cat >expect <<-\EOF &&
1033 git config --file=notyet test.frotz &&
1034 git config --file=notyet test.xyzzy
1036 test_cmp expect actual
1039 test_expect_success SYMLINKS
'symlink to nonexistent configuration' '
1040 ln -s doesnotexist linktonada &&
1041 ln -s linktonada linktolinktonada &&
1042 test_must_fail git config --file=linktonada --list &&
1043 test_must_fail git config --file=linktolinktonada --list
1046 test_expect_success
'check split_cmdline return' "
1047 git config alias.split-cmdline-fix 'echo \"' &&
1048 test_must_fail git split-cmdline-fix &&
1051 git commit -m 'initial commit' &&
1052 git config branch.main.mergeoptions 'echo \"' &&
1053 test_must_fail git merge main
1056 test_expect_success
'git -c "key=value" support' '
1057 cat >expect <<-\EOF &&
1063 git -c section.name=value config section.name &&
1064 git -c foo.CamelCase=value config foo.camelcase &&
1065 git -c foo.flag config --bool foo.flag
1067 test_cmp expect actual &&
1068 test_must_fail git -c name=value config section.name
1071 # We just need a type-specifier here that cares about the
1072 # distinction internally between a NULL boolean and a real
1073 # string (because most of git's internal parsers do care).
1074 # Using "--path" works, but we do not otherwise care about
1076 test_expect_success
'git -c can represent empty string' '
1078 git -c foo.empty= config --path foo.empty >actual &&
1079 test_cmp expect actual
1082 test_expect_success
'key sanity-checking' '
1083 test_must_fail git config foo=bar &&
1084 test_must_fail git config foo=.bar &&
1085 test_must_fail git config foo.ba=r &&
1086 test_must_fail git config foo.1bar &&
1087 test_must_fail git config foo."ba
1089 test_must_fail git config . false &&
1090 test_must_fail git config .foo false &&
1091 test_must_fail git config foo. false &&
1092 test_must_fail git config .foo. false &&
1093 git config foo.bar true &&
1094 git config foo."ba =z".bar false
1097 test_expect_success
'git -c works with aliases of builtins' '
1098 git config alias.checkconfig "-c foo.check=bar config foo.check" &&
1100 git checkconfig >actual &&
1101 test_cmp expect actual
1104 test_expect_success
'aliases can be CamelCased' '
1105 test_config alias.CamelCased "rev-parse HEAD" &&
1106 git CamelCased >out &&
1107 git rev-parse HEAD >expect &&
1111 test_expect_success
'git -c does not split values on equals' '
1112 echo "value with = in it" >expect &&
1113 git -c section.foo="value with = in it" config section.foo >actual &&
1114 test_cmp expect actual
1117 test_expect_success
'git -c dies on bogus config' '
1118 test_must_fail git -c core.bare=foo rev-parse
1121 test_expect_success
'git -c complains about empty key' '
1122 test_must_fail git -c "=foo" rev-parse
1125 test_expect_success
'git -c complains about empty key and value' '
1126 test_must_fail git -c "" rev-parse
1129 test_expect_success
'multiple git -c appends config' '
1130 test_config alias.x "!git -c x.two=2 config --get-regexp ^x\.*" &&
1131 cat >expect <<-\EOF &&
1135 git -c x.one=1 x >actual &&
1136 test_cmp expect actual
1139 test_expect_success
'last one wins: two level vars' '
1141 # sec.var and sec.VAR are the same variable, as the first
1142 # and the last level of a configuration variable name is
1147 git -c sec.var=val -c sec.VAR=VAL config --get sec.var >actual &&
1148 test_cmp expect actual &&
1149 git -c SEC.var=val -c sec.var=VAL config --get sec.var >actual &&
1150 test_cmp expect actual &&
1152 git -c sec.var=val -c sec.VAR=VAL config --get SEC.var >actual &&
1153 test_cmp expect actual &&
1154 git -c SEC.var=val -c sec.var=VAL config --get sec.VAR >actual &&
1155 test_cmp expect actual
1158 test_expect_success
'last one wins: three level vars' '
1160 # v.a.r and v.A.r are not the same variable, as the middle
1161 # level of a three-level configuration variable name is
1165 git -c v.a.r=val -c v.A.r=VAL config --get v.a.r >actual &&
1166 test_cmp expect actual &&
1167 git -c v.a.r=val -c v.A.r=VAL config --get V.a.R >actual &&
1168 test_cmp expect actual &&
1170 # v.a.r and V.a.R are the same variable, as the first
1171 # and the last level of a configuration variable name is
1175 git -c v.a.r=val -c v.a.R=VAL config --get v.a.r >actual &&
1176 test_cmp expect actual &&
1177 git -c v.a.r=val -c V.a.r=VAL config --get v.a.r >actual &&
1178 test_cmp expect actual &&
1179 git -c v.a.r=val -c v.a.R=VAL config --get V.a.R >actual &&
1180 test_cmp expect actual &&
1181 git -c v.a.r=val -c V.a.r=VAL config --get V.a.R >actual &&
1182 test_cmp expect actual
1185 test_expect_success
'old-fashioned settings are case insensitive' '
1186 test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
1188 cat >testConfig_actual <<-EOF &&
1192 q_to_tab >testConfig_expect <<-EOF &&
1196 git config -f testConfig_actual "v.a.r" value2 &&
1197 test_cmp testConfig_expect testConfig_actual &&
1199 cat >testConfig_actual <<-EOF &&
1203 q_to_tab >testConfig_expect <<-EOF &&
1207 git config -f testConfig_actual "V.a.R" value2 &&
1208 test_cmp testConfig_expect testConfig_actual &&
1210 cat >testConfig_actual <<-EOF &&
1214 q_to_tab >testConfig_expect <<-EOF &&
1219 git config -f testConfig_actual "V.A.r" value2 &&
1220 test_cmp testConfig_expect testConfig_actual &&
1222 cat >testConfig_actual <<-EOF &&
1226 q_to_tab >testConfig_expect <<-EOF &&
1231 git config -f testConfig_actual "v.A.r" value2 &&
1232 test_cmp testConfig_expect testConfig_actual
1235 test_expect_success
'setting different case sensitive subsections ' '
1236 test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
1238 cat >testConfig_actual <<-EOF &&
1248 q_to_tab >testConfig_expect <<-EOF &&
1261 git config -f testConfig_actual a.b.c v2 &&
1262 # match section and subsection, key is cased differently.
1263 git config -f testConfig_actual K.E.y v2 &&
1264 # section and key are matched case insensitive, but subsection needs
1265 # to match; When writing out new values only the key is adjusted
1266 git config -f testConfig_actual v.A.r v2 &&
1267 # subsection is not matched:
1268 git config -f testConfig_actual d.E.f v2 &&
1269 test_cmp testConfig_expect testConfig_actual
1272 for VAR
in a .a a. a
.0b a.
"b c". a.
"b c".0d
1274 test_expect_success
"git -c $VAR=VAL rejects invalid '$VAR'" '
1275 test_must_fail git -c "$VAR=VAL" config -l
1279 for VAR
in a.b a.
"b c".d
1281 test_expect_success
"git -c $VAR=VAL works with valid '$VAR'" '
1283 git -c "$VAR=VAL" config --get "$VAR" >actual &&
1284 test_cmp expect actual
1288 test_expect_success
'git -c is not confused by empty environment' '
1289 GIT_CONFIG_PARAMETERS="" git -c x.one=1 config --list
1292 test_expect_success
'detect bogus GIT_CONFIG_PARAMETERS' '
1293 cat >expect <<-\EOF &&
1297 GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ} ${SQ}env.two=two${SQ}" \
1298 git config --get-regexp "env.*" >actual &&
1299 test_cmp expect actual &&
1301 cat >expect <<-EOF &&
1305 GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ$SQ$SQ ${SQ}env.two=two${SQ}" \
1306 git config --get-regexp "env.*" >actual &&
1307 test_cmp expect actual &&
1309 test_must_fail env \
1310 GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ ${SQ}env.two=two${SQ}" \
1311 git config --get-regexp "env.*"
1314 test_expect_success
'git config --edit works' '
1315 git config -f tmp test.value no &&
1316 echo test.value=yes >expect &&
1317 GIT_EDITOR="echo [test]value=yes >" git config -f tmp --edit &&
1318 git config -f tmp --list >actual &&
1319 test_cmp expect actual
1322 test_expect_success
'git config --edit respects core.editor' '
1323 git config -f tmp test.value no &&
1324 echo test.value=yes >expect &&
1325 test_config core.editor "echo [test]value=yes >" &&
1326 git config -f tmp --edit &&
1327 git config -f tmp --list >actual &&
1328 test_cmp expect actual
1331 # malformed configuration files
1332 test_expect_success
'barf on syntax error' '
1333 cat >.git/config <<-\EOF &&
1334 # broken section line
1338 test_must_fail git config --get section.key >actual 2>error &&
1339 test_i18ngrep " line 3 " error
1342 test_expect_success
'barf on incomplete section header' '
1343 cat >.git/config <<-\EOF &&
1344 # broken section line
1348 test_must_fail git config --get section.key >actual 2>error &&
1349 test_i18ngrep " line 2 " error
1352 test_expect_success
'barf on incomplete string' '
1353 cat >.git/config <<-\EOF &&
1354 # broken section line
1358 test_must_fail git config --get section.key >actual 2>error &&
1359 test_i18ngrep " line 3 " error
1362 test_expect_success
'urlmatch' '
1363 cat >.git/config <<-\EOF &&
1366 [http "https://weak.example.com"]
1368 cookieFile = /tmp/cookie.txt
1371 test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
1372 test_must_be_empty actual &&
1374 echo true >expect &&
1375 git config --bool --get-urlmatch http.SSLverify https://good.example.com >actual &&
1376 test_cmp expect actual &&
1378 echo false >expect &&
1379 git config --bool --get-urlmatch http.sslverify https://weak.example.com >actual &&
1380 test_cmp expect actual &&
1383 echo http.cookiefile /tmp/cookie.txt &&
1384 echo http.sslverify false
1386 git config --get-urlmatch HTTP https://weak.example.com >actual &&
1387 test_cmp expect actual
1390 test_expect_success
'urlmatch favors more specific URLs' '
1391 cat >.git/config <<-\EOF &&
1392 [http "https://example.com/"]
1393 cookieFile = /tmp/root.txt
1394 [http "https://example.com/subdirectory"]
1395 cookieFile = /tmp/subdirectory.txt
1396 [http "https://user@example.com/"]
1397 cookieFile = /tmp/user.txt
1398 [http "https://averylonguser@example.com/"]
1399 cookieFile = /tmp/averylonguser.txt
1400 [http "https://preceding.example.com"]
1401 cookieFile = /tmp/preceding.txt
1402 [http "https://*.example.com"]
1403 cookieFile = /tmp/wildcard.txt
1404 [http "https://*.example.com/wildcardwithsubdomain"]
1405 cookieFile = /tmp/wildcardwithsubdomain.txt
1406 [http "https://*.example.*"]
1407 cookieFile = /tmp/multiwildcard.txt
1408 [http "https://trailing.example.com"]
1409 cookieFile = /tmp/trailing.txt
1410 [http "https://user@*.example.com/"]
1411 cookieFile = /tmp/wildcardwithuser.txt
1412 [http "https://sub.example.com/"]
1413 cookieFile = /tmp/sub.txt
1416 echo http.cookiefile /tmp/root.txt >expect &&
1417 git config --get-urlmatch HTTP https://example.com >actual &&
1418 test_cmp expect actual &&
1420 echo http.cookiefile /tmp/subdirectory.txt >expect &&
1421 git config --get-urlmatch HTTP https://example.com/subdirectory >actual &&
1422 test_cmp expect actual &&
1424 echo http.cookiefile /tmp/subdirectory.txt >expect &&
1425 git config --get-urlmatch HTTP https://example.com/subdirectory/nested >actual &&
1426 test_cmp expect actual &&
1428 echo http.cookiefile /tmp/user.txt >expect &&
1429 git config --get-urlmatch HTTP https://user@example.com/ >actual &&
1430 test_cmp expect actual &&
1432 echo http.cookiefile /tmp/subdirectory.txt >expect &&
1433 git config --get-urlmatch HTTP https://averylonguser@example.com/subdirectory >actual &&
1434 test_cmp expect actual &&
1436 echo http.cookiefile /tmp/preceding.txt >expect &&
1437 git config --get-urlmatch HTTP https://preceding.example.com >actual &&
1438 test_cmp expect actual &&
1440 echo http.cookiefile /tmp/wildcard.txt >expect &&
1441 git config --get-urlmatch HTTP https://wildcard.example.com >actual &&
1442 test_cmp expect actual &&
1444 echo http.cookiefile /tmp/sub.txt >expect &&
1445 git config --get-urlmatch HTTP https://sub.example.com/wildcardwithsubdomain >actual &&
1446 test_cmp expect actual &&
1448 echo http.cookiefile /tmp/trailing.txt >expect &&
1449 git config --get-urlmatch HTTP https://trailing.example.com >actual &&
1450 test_cmp expect actual &&
1452 echo http.cookiefile /tmp/sub.txt >expect &&
1453 git config --get-urlmatch HTTP https://user@sub.example.com >actual &&
1454 test_cmp expect actual &&
1456 echo http.cookiefile /tmp/multiwildcard.txt >expect &&
1457 git config --get-urlmatch HTTP https://wildcard.example.org >actual &&
1458 test_cmp expect actual
1461 test_expect_success
'urlmatch with wildcard' '
1462 cat >.git/config <<-\EOF &&
1465 [http "https://*.example.com"]
1467 cookieFile = /tmp/cookie.txt
1470 test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
1471 test_must_be_empty actual &&
1473 echo true >expect &&
1474 git config --bool --get-urlmatch http.SSLverify https://example.com >actual &&
1475 test_cmp expect actual &&
1477 echo true >expect &&
1478 git config --bool --get-urlmatch http.SSLverify https://good-example.com >actual &&
1479 test_cmp expect actual &&
1481 echo true >expect &&
1482 git config --bool --get-urlmatch http.sslverify https://deep.nested.example.com >actual &&
1483 test_cmp expect actual &&
1485 echo false >expect &&
1486 git config --bool --get-urlmatch http.sslverify https://good.example.com >actual &&
1487 test_cmp expect actual &&
1490 echo http.cookiefile /tmp/cookie.txt &&
1491 echo http.sslverify false
1493 git config --get-urlmatch HTTP https://good.example.com >actual &&
1494 test_cmp expect actual &&
1496 echo http.sslverify >expect &&
1497 git config --get-urlmatch HTTP https://more.example.com.au >actual &&
1498 test_cmp expect actual
1501 # good section hygiene
1502 test_expect_success
'--unset last key removes section (except if commented)' '
1503 cat >.git/config <<-\EOF &&
1504 # some generic comment on the configuration file itself
1505 # a comment specific to this "section" section.
1507 # some intervening lines
1508 # that should also be dropped
1511 # please be careful when you update the above variable
1514 cat >expect <<-\EOF &&
1515 # some generic comment on the configuration file itself
1516 # a comment specific to this "section" section.
1518 # some intervening lines
1519 # that should also be dropped
1521 # please be careful when you update the above variable
1524 git config --unset section.key &&
1525 test_cmp expect .git/config &&
1527 cat >.git/config <<-\EOF &&
1533 cat >expect <<-\EOF &&
1537 git config --unset section.key &&
1538 test_cmp expect .git/config &&
1540 q_to_tab >.git/config <<-\EOF &&
1547 git config --unset two.key &&
1548 ! grep two .git/config &&
1550 q_to_tab >.git/config <<-\EOF &&
1557 git config --unset-all one.key &&
1558 test_line_count = 0 .git/config &&
1560 q_to_tab >.git/config <<-\EOF &&
1563 Q# a comment not at the start
1567 git config --unset two.key &&
1568 grep two .git/config &&
1570 q_to_tab >.git/config <<-\EOF &&
1572 Qkey = not [two "subsection"]
1579 git config --unset two.subsection.key &&
1580 test "not [two subsection]" = "$(git config one.key)" &&
1581 test_line_count = 3 .git/config
1584 test_expect_success
'--unset-all removes section if empty & uncommented' '
1585 cat >.git/config <<-\EOF &&
1591 git config --unset-all section.key &&
1592 test_line_count = 0 .git/config
1595 test_expect_success
'adding a key into an empty section reuses header' '
1596 cat >.git/config <<-\EOF &&
1600 q_to_tab >expect <<-\EOF &&
1605 git config section.key value &&
1606 test_cmp expect .git/config
1609 test_expect_success POSIXPERM
,PERL
'preserves existing permissions' '
1610 chmod 0600 .git/config &&
1611 git config imap.pass Hunter2 &&
1613 "die q(badset) if ((stat(q(.git/config)))[2] & 07777) != 0600" &&
1614 git config --rename-section imap pop &&
1616 "die q(badrename) if ((stat(q(.git/config)))[2] & 07777) != 0600"
1619 ! test_have_prereq MINGW ||
1620 HOME
="$(pwd)" # convert to Windows path
1622 test_expect_success
'set up --show-origin tests' '
1623 INCLUDE_DIR="$HOME/include" &&
1624 mkdir -p "$INCLUDE_DIR" &&
1625 cat >"$INCLUDE_DIR"/absolute.include <<-\EOF &&
1629 cat >"$INCLUDE_DIR"/relative.include <<-\EOF &&
1633 cat >"$HOME"/.gitconfig <<-EOF &&
1638 path = "$INCLUDE_DIR/absolute.include"
1640 cat >.git/config <<-\EOF
1645 path = ../include/relative.include
1649 test_expect_success
'--show-origin with --list' '
1650 cat >expect <<-EOF &&
1651 file:$HOME/.gitconfig user.global=true
1652 file:$HOME/.gitconfig user.override=global
1653 file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include
1654 file:$INCLUDE_DIR/absolute.include user.absolute=include
1655 file:.git/config user.local=true
1656 file:.git/config user.override=local
1657 file:.git/config include.path=../include/relative.include
1658 file:.git/../include/relative.include user.relative=include
1659 command line: user.cmdline=true
1661 git -c user.cmdline=true config --list --show-origin >output &&
1662 test_cmp expect output
1665 test_expect_success
'--show-origin with --list --null' '
1666 cat >expect <<-EOF &&
1667 file:$HOME/.gitconfigQuser.global
1668 trueQfile:$HOME/.gitconfigQuser.override
1669 globalQfile:$HOME/.gitconfigQinclude.path
1670 $INCLUDE_DIR/absolute.includeQfile:$INCLUDE_DIR/absolute.includeQuser.absolute
1671 includeQfile:.git/configQuser.local
1672 trueQfile:.git/configQuser.override
1673 localQfile:.git/configQinclude.path
1674 ../include/relative.includeQfile:.git/../include/relative.includeQuser.relative
1675 includeQcommand line:Quser.cmdline
1678 git -c user.cmdline=true config --null --list --show-origin >output.raw &&
1679 nul_to_q <output.raw >output &&
1680 # The here-doc above adds a newline that the --null output would not
1681 # include. Add it here to make the two comparable.
1683 test_cmp expect output
1686 test_expect_success
'--show-origin with single file' '
1687 cat >expect <<-\EOF &&
1688 file:.git/config user.local=true
1689 file:.git/config user.override=local
1690 file:.git/config include.path=../include/relative.include
1692 git config --local --list --show-origin >output &&
1693 test_cmp expect output
1696 test_expect_success
'--show-origin with --get-regexp' '
1697 cat >expect <<-EOF &&
1698 file:$HOME/.gitconfig user.global true
1699 file:.git/config user.local true
1701 git config --show-origin --get-regexp "user\.[g|l].*" >output &&
1702 test_cmp expect output
1705 test_expect_success
'--show-origin getting a single key' '
1706 cat >expect <<-\EOF &&
1707 file:.git/config local
1709 git config --show-origin user.override >output &&
1710 test_cmp expect output
1713 test_expect_success
'set up custom config file' '
1714 CUSTOM_CONFIG_FILE="custom.conf" &&
1715 cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
1721 test_expect_success
!MINGW
'set up custom config file with special name characters' '
1722 WEIRDLY_NAMED_FILE="file\" (dq) and spaces.conf" &&
1723 cp "$CUSTOM_CONFIG_FILE" "$WEIRDLY_NAMED_FILE"
1726 test_expect_success
!MINGW
'--show-origin escape special file name characters' '
1727 cat >expect <<-\EOF &&
1728 file:"file\" (dq) and spaces.conf" user.custom=true
1730 git config --file "$WEIRDLY_NAMED_FILE" --show-origin --list >output &&
1731 test_cmp expect output
1734 test_expect_success
'--show-origin stdin' '
1735 cat >expect <<-\EOF &&
1736 standard input: user.custom=true
1738 git config --file - --show-origin --list <"$CUSTOM_CONFIG_FILE" >output &&
1739 test_cmp expect output
1742 test_expect_success
'--show-origin stdin with file include' '
1743 cat >"$INCLUDE_DIR"/stdin.include <<-EOF &&
1747 cat >expect <<-EOF &&
1748 file:$INCLUDE_DIR/stdin.include include
1750 echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" |
1751 git config --show-origin --includes --file - user.stdin >output &&
1753 test_cmp expect output
1756 test_expect_success
'--show-origin blob' '
1757 blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
1758 cat >expect <<-EOF &&
1759 blob:$blob user.custom=true
1761 git config --blob=$blob --show-origin --list >output &&
1762 test_cmp expect output
1765 test_expect_success
'--show-origin blob ref' '
1766 cat >expect <<-\EOF &&
1767 blob:main:custom.conf user.custom=true
1769 git add "$CUSTOM_CONFIG_FILE" &&
1770 git commit -m "new config file" &&
1771 git config --blob=main:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
1772 test_cmp expect output
1775 test_expect_success
'--show-scope with --list' '
1776 cat >expect <<-EOF &&
1777 global user.global=true
1778 global user.override=global
1779 global include.path=$INCLUDE_DIR/absolute.include
1780 global user.absolute=include
1781 local user.local=true
1782 local user.override=local
1783 local include.path=../include/relative.include
1784 local user.relative=include
1785 command user.cmdline=true
1787 git -c user.cmdline=true config --list --show-scope >output &&
1788 test_cmp expect output
1791 test_expect_success
!MINGW
'--show-scope with --blob' '
1792 blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
1793 cat >expect <<-EOF &&
1794 command user.custom=true
1796 git config --blob=$blob --show-scope --list >output &&
1797 test_cmp expect output
1800 test_expect_success
'--show-scope with --local' '
1801 cat >expect <<-\EOF &&
1802 local user.local=true
1803 local user.override=local
1804 local include.path=../include/relative.include
1806 git config --local --list --show-scope >output &&
1807 test_cmp expect output
1810 test_expect_success
'--show-scope getting a single value' '
1811 cat >expect <<-\EOF &&
1814 git config --show-scope --get user.local >output &&
1815 test_cmp expect output
1818 test_expect_success
'--show-scope with --show-origin' '
1819 cat >expect <<-EOF &&
1820 global file:$HOME/.gitconfig user.global=true
1821 global file:$HOME/.gitconfig user.override=global
1822 global file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include
1823 global file:$INCLUDE_DIR/absolute.include user.absolute=include
1824 local file:.git/config user.local=true
1825 local file:.git/config user.override=local
1826 local file:.git/config include.path=../include/relative.include
1827 local file:.git/../include/relative.include user.relative=include
1828 command command line: user.cmdline=true
1830 git -c user.cmdline=true config --list --show-origin --show-scope >output &&
1831 test_cmp expect output
1834 for opt
in --local --worktree
1836 test_expect_success
"$opt requires a repo" '
1837 # we expect 128 to ensure that we do not simply
1838 # fail to find anything and return code "1"
1839 test_expect_code 128 nongit git config $opt foo.bar
1843 cat >.git
/config
<<-\EOF &&
1850 test_expect_success 'identical modern --type specifiers are allowed' '
1851 test_cmp_config 1048576 --type=int --type=int section.big
1854 test_expect_success 'identical legacy --type specifiers are allowed' '
1855 test_cmp_config 1048576 --int --int section.big
1858 test_expect_success 'identical mixed --type specifiers are allowed' '
1859 test_cmp_config 1048576 --int --type=int section.big
1862 test_expect_success 'non-identical modern --type specifiers are not allowed' '
1863 test_must_fail git config --type=int --type=bool section.big 2>error &&
1864 test_i18ngrep "only one type at a time" error
1867 test_expect_success 'non-identical legacy --type specifiers are not allowed' '
1868 test_must_fail git config --int --bool section.big 2>error &&
1869 test_i18ngrep "only one type at a time" error
1872 test_expect_success 'non-identical mixed --type specifiers are not allowed' '
1873 test_must_fail git config --type=int --bool section.big 2>error &&
1874 test_i18ngrep "only one type at a time" error
1877 test_expect_success '--type allows valid type specifiers' '
1878 test_cmp_config true --type=bool section.foo
1881 test_expect_success '--no-type unsets type specifiers' '
1882 test_cmp_config 10 --type=bool --no-type section.number
1885 test_expect_success 'unset type specifiers may be reset to conflicting ones' '
1886 test_cmp_config 1048576 --type=bool --no-type --type=int section.big
1889 test_expect_success '--type rejects unknown specifiers' '
1890 test_must_fail git config --type=nonsense section.foo 2>error &&
1891 test_i18ngrep "unrecognized --type argument" error
1894 test_expect_success '--replace-all does not invent newlines' '
1895 q_to_tab >.git/config <<-\
EOF &&
1903 q_to_tab >expect <<-\EOF &&
1911 git config --replace-all abc.key b &&
1912 test_cmp expect .git/config
1915 test_expect_success 'set all config with value-pattern' '
1916 test_when_finished rm -f config initial &&
1917 git config --file=initial abc.key one &&
1919 # no match => add new entry
1920 cp initial config &&
1921 git config --file=config abc.key two a+ &&
1922 git config --file=config --list >actual &&
1923 cat >expect <<-\EOF &&
1927 test_cmp expect actual &&
1929 # multiple matches => failure
1930 test_must_fail git config --file=config abc.key three o+ 2>err &&
1931 test_i18ngrep "has multiple values" err &&
1933 # multiple values, no match => add
1934 git config --file=config abc.key three a+ &&
1935 git config --file=config --list >actual &&
1936 cat >expect <<-\EOF &&
1941 test_cmp expect actual &&
1943 # single match => replace
1944 git config --file=config abc.key four h+ &&
1945 git config --file=config --list >actual &&
1946 cat >expect <<-\EOF &&
1951 test_cmp expect actual
1954 test_expect_success '--replace-all and value-pattern' '
1955 test_when_finished rm -f config &&
1956 git config --file=config --add abc.key one &&
1957 git config --file=config --add abc.key two &&
1958 git config --file=config --add abc.key three &&
1959 git config --file=config --replace-all abc.key four "o+" &&
1960 git config --file=config --list >actual &&
1961 cat >expect <<-\EOF &&
1965 test_cmp expect actual
1968 test_expect_success 'refuse --fixed-value for incompatible actions' '
1969 test_when_finished rm -f config &&
1970 git config --file=config dev.null bogus &&
1972 # These modes do not allow --fixed-value at all
1973 test_must_fail git config --file=config --fixed-value --add dev.null bogus &&
1974 test_must_fail git config --file=config --fixed-value --get-urlmatch dev.null bogus &&
1975 test_must_fail git config --file=config --fixed-value --get-urlmatch dev.null bogus &&
1976 test_must_fail git config --file=config --fixed-value --rename-section dev null &&
1977 test_must_fail git config --file=config --fixed-value --remove-section dev &&
1978 test_must_fail git config --file=config --fixed-value --list &&
1979 test_must_fail git config --file=config --fixed-value --get-color dev.null &&
1980 test_must_fail git config --file=config --fixed-value --get-colorbool dev.null &&
1982 # These modes complain when --fixed-value has no value-pattern
1983 test_must_fail git config --file=config --fixed-value dev.null bogus &&
1984 test_must_fail git config --file=config --fixed-value --replace-all dev.null bogus &&
1985 test_must_fail git config --file=config --fixed-value --get dev.null &&
1986 test_must_fail git config --file=config --fixed-value --get-all dev.null &&
1987 test_must_fail git config --file=config --fixed-value --get-regexp "dev.*" &&
1988 test_must_fail git config --file=config --fixed-value --unset dev.null &&
1989 test_must_fail git config --file=config --fixed-value --unset-all dev.null
1992 test_expect_success '--fixed-value uses exact string matching' '
1993 test_when_finished rm -f config initial &&
1994 META="a+b*c?d[e]f.g" &&
1995 git config --file=initial fixed.test "$META" &&
1997 cp initial config &&
1998 git config --file=config fixed.test bogus "$META" &&
1999 git config --file=config --list >actual &&
2000 cat >expect <<-EOF &&
2004 test_cmp expect actual &&
2006 cp initial config &&
2007 git config --file=config --fixed-value fixed.test bogus "$META" &&
2008 git config --file=config --list >actual &&
2009 cat >expect <<-\EOF &&
2012 test_cmp expect actual &&
2014 cp initial config &&
2015 test_must_fail git config --file=config --unset fixed.test "$META" &&
2016 git config --file=config --fixed-value --unset fixed.test "$META" &&
2017 test_must_fail git config --file=config fixed.test &&
2019 cp initial config &&
2020 test_must_fail git config --file=config --unset-all fixed.test "$META" &&
2021 git config --file=config --fixed-value --unset-all fixed.test "$META" &&
2022 test_must_fail git config --file=config fixed.test &&
2024 cp initial config &&
2025 git config --file=config --replace-all fixed.test bogus "$META" &&
2026 git config --file=config --list >actual &&
2027 cat >expect <<-EOF &&
2031 test_cmp expect actual &&
2033 git config --file=config --fixed-value --replace-all fixed.test bogus "$META" &&
2034 git config --file=config --list >actual &&
2035 cat >expect <<-EOF &&
2039 test_cmp expect actual
2042 test_expect_success '--get and --get-all with --fixed-value' '
2043 test_when_finished rm -f config &&
2044 META="a+b*c?d[e]f.g" &&
2045 git config --file=config fixed.test bogus &&
2046 git config --file=config --add fixed.test "$META" &&
2048 git config --file=config --get fixed.test bogus &&
2049 test_must_fail git config --file=config --get fixed.test "$META" &&
2050 git config --file=config --get --fixed-value fixed.test "$META" &&
2051 test_must_fail git config --file=config --get --fixed-value fixed.test non-existent &&
2053 git config --file=config --get-all fixed.test bogus &&
2054 test_must_fail git config --file=config --get-all fixed.test "$META" &&
2055 git config --file=config --get-all --fixed-value fixed.test "$META" &&
2056 test_must_fail git config --file=config --get-all --fixed-value fixed.test non-existent &&
2058 git config --file=config --get-regexp fixed+ bogus &&
2059 test_must_fail git config --file=config --get-regexp fixed+ "$META" &&
2060 git config --file=config --get-regexp --fixed-value fixed+ "$META" &&
2061 test_must_fail git config --file=config --get-regexp --fixed-value fixed+ non-existent