fetch: fix segfault in --negotiate-only without --negotiation-tip=*
[alt-git.git] / t / t1300-config.sh
blob9ff46f3b0471fb146bec00329459040619edd88e
1 #!/bin/sh
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
11 . ./test-lib.sh
13 test_expect_success 'clear default config' '
14 rm -f .git/config
17 cat > expect << EOF
18 [section]
19 penguin = little blue
20 EOF
21 test_expect_success 'initial' '
22 git config section.penguin "little blue" &&
23 test_cmp expect .git/config
26 cat > expect << EOF
27 [section]
28 penguin = little blue
29 Movie = BadPhysics
30 EOF
31 test_expect_success 'mixed case' '
32 git config Section.Movie BadPhysics &&
33 test_cmp expect .git/config
36 cat > expect << EOF
37 [section]
38 penguin = little blue
39 Movie = BadPhysics
40 [Sections]
41 WhatEver = Second
42 EOF
43 test_expect_success 'similar section' '
44 git config Sections.WhatEver Second &&
45 test_cmp expect .git/config
48 cat > expect << EOF
49 [section]
50 penguin = little blue
51 Movie = BadPhysics
52 UPPERCASE = true
53 [Sections]
54 WhatEver = Second
55 EOF
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
69 cat > expect << EOF
70 [section]
71 penguin = very blue
72 Movie = BadPhysics
73 UPPERCASE = true
74 penguin = kingpin
75 [Sections]
76 WhatEver = Second
77 EOF
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 &&
91 [section.SubSection]
92 key = one
93 [section "SubSection"]
94 key = two
95 EOF
96 test_cmp_config one section.subsection.key &&
97 test_cmp_config two section.SubSection.key
100 cat > .git/config <<\EOF
101 [alpha]
102 bar = foo
103 [beta]
104 baz = multiple \
105 lines
106 foo = bar
109 test_expect_success 'unset with cont. lines' '
110 git config --unset beta.baz
113 cat > expect <<\EOF
114 [alpha]
115 bar = foo
116 [beta]
117 foo = bar
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
126 # empty line
127 ; comment
128 haha ="beta" # last silly comment
129 haha = hello
130 haha = bello
131 [nextSection] noNewline = ouch
134 cp .git/config .git/config2
136 test_expect_success 'multiple unset' '
137 git config --unset-all beta.haha
140 cat > expect << EOF
141 [beta] ; silly comment # another comment
142 noIndent= sillyValue ; 'nother silly comment
144 # empty line
145 ; 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
160 rm .git/config2
162 test_expect_success '--replace-all' '
163 git config --replace-all beta.haha gamma
166 cat > expect << EOF
167 [beta] ; silly comment # another comment
168 noIndent= sillyValue ; 'nother silly comment
170 # empty line
171 ; comment
172 haha = gamma
173 [nextSection] noNewline = ouch
176 test_expect_success 'all replaced' '
177 test_cmp expect .git/config
180 cat > expect << EOF
181 [beta] ; silly comment # another comment
182 noIndent= sillyValue ; 'nother silly comment
184 # empty line
185 ; comment
186 haha = alpha
187 [nextSection] noNewline = ouch
189 test_expect_success 'really mean test' '
190 git config beta.haha alpha &&
191 test_cmp expect .git/config
194 cat > expect << EOF
195 [beta] ; silly comment # another comment
196 noIndent= sillyValue ; 'nother silly comment
198 # empty line
199 ; comment
200 haha = alpha
201 [nextSection]
202 nonewline = wow
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
213 cat > expect << EOF
214 [beta] ; silly comment # another comment
215 noIndent= sillyValue ; 'nother silly comment
217 # empty line
218 ; comment
219 [nextSection]
220 nonewline = wow
222 test_expect_success 'unset' '
223 git config --unset beta.haha &&
224 test_cmp expect .git/config
227 cat > expect << EOF
228 [beta] ; silly comment # another comment
229 noIndent= sillyValue ; 'nother silly comment
231 # empty line
232 ; comment
233 [nextSection]
234 nonewline = wow
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 &&
257 wow2 for me
259 git config --get-all nextsection.nonewline >actual &&
260 test_cmp expect actual
263 cat > expect << EOF
264 [beta] ; silly comment # another comment
265 noIndent= sillyValue ; 'nother silly comment
267 # empty line
268 ; comment
269 [nextSection]
270 nonewline = wow3
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
286 cat > expect << EOF
287 [beta] ; silly comment # another comment
288 noIndent= sillyValue ; 'nother silly comment
290 # empty line
291 ; comment
292 [nextSection]
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
309 cat > expect << EOF
310 [beta] ; silly comment # another comment
311 noIndent= sillyValue ; 'nother silly comment
313 # empty line
314 ; comment
315 [nextSection]
316 NoNewLine = wow2 for me
317 [123456]
318 a123 = 987
319 [Version "1.2.3eX"]
320 Alpha = beta
323 test_expect_success 'hierarchical section value' '
324 test_cmp expect .git/config
327 cat > expect << EOF
328 beta.noindent=sillyValue
329 nextsection.nonewline=wow2 for me
330 123456.a123=987
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
343 cat > expect << EOF
344 beta.noindent
345 nextsection.nonewline
346 123456.a123
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
355 cat > expect << EOF
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
365 cat > expect << EOF
366 beta.noindent
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
375 cat > expect << EOF
376 wow2 for me
377 wow4 for you
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
387 [novalue]
388 variable
389 [emptyvalue]
390 variable =
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
422 echo true > expect
424 test_expect_success 'get bool variable with no value' '
425 git config --bool novalue.variable > output &&
426 test_cmp expect output
429 echo false > expect
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
442 [a.b]
443 c = d
446 cat > expect << EOF
447 [a.b]
448 c = d
450 x = y
453 test_expect_success 'new section is partial match of another' '
454 git config a.x y &&
455 test_cmp expect .git/config
458 cat > expect << EOF
459 [a.b]
460 c = d
462 x = y
463 b = c
465 x = y
468 test_expect_success 'new variable inserts into proper section' '
469 git config b.x y &&
470 git config a.b c &&
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
480 [ein]
481 bahn = strasse
484 cat > expect << EOF
485 ein.bahn=strasse
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' '
512 mkdir x &&
513 test_cmp_config -C x strasse --file=../other-config --get ein.bahn
516 cat > expect << EOF
517 [ein]
518 bahn = strasse
519 [anwohner]
520 park = ausweis
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
529 # Hallo
530 #Bello
531 [branch "eins"]
532 x = 1
533 [branch.eins]
534 y = 1
535 [branch "1 234 blabl/a"]
536 weird
539 test_expect_success 'rename section' '
540 git config --rename-section branch.eins branch.zwei
543 cat > expect << EOF
544 # Hallo
545 #Bello
546 [branch "zwei"]
547 x = 1
548 [branch "zwei"]
549 y = 1
550 [branch "1 234 blabl/a"]
551 weird
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
571 cat > expect << EOF
572 # Hallo
573 #Bello
574 [branch "zwei"]
575 x = 1
576 [branch "zwei"]
577 y = 1
578 [branch "drei"]
579 weird
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
594 cat > expect << EOF
595 # Hallo
596 #Bello
597 [branch "zwei"]
598 x = 1
599 [branch "zwei"]
600 y = 1
601 [branch "drei"]
602 weird
603 [branch "zwei"]
604 z = 1
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
627 cat > expect << EOF
628 # Hallo
629 #Bello
630 [branch "drei"]
631 weird
634 test_expect_success 'section was removed properly' '
635 test_cmp expect .git/config
638 cat > expect << EOF
639 [gitcvs]
640 enabled = true
641 dbname = %Ggitcvs2.%a.%m.sqlite
642 [gitcvs "ext"]
643 dbname = %Ggitcvs1.%a.%m.sqlite
646 test_expect_success 'section ending' '
647 rm -f .git/config &&
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 &&
658 echo 1024 >expect &&
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 &&
667 echo >expect &&
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 'invalid unit boolean' '
679 git config commit.gpgsign "1true" &&
680 test_cmp_config 1true commit.gpgsign &&
681 test_must_fail git config --bool --get commit.gpgsign 2>actual &&
682 test_i18ngrep "bad boolean config value .1true. for .commit.gpgsign." actual
685 test_expect_success 'line number is reported correctly' '
686 printf "[bool]\n\tvar\n" >invalid &&
687 test_must_fail git config -f invalid --path bool.var 2>actual &&
688 test_i18ngrep "line 2" actual
691 test_expect_success 'invalid stdin config' '
692 echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
693 test_i18ngrep "bad config line 1 in standard input" output
696 cat > expect << EOF
697 true
698 false
699 true
700 false
701 true
702 false
703 true
704 false
707 test_expect_success bool '
709 git config bool.true1 01 &&
710 git config bool.true2 -1 &&
711 git config bool.true3 YeS &&
712 git config bool.true4 true &&
713 git config bool.false1 000 &&
714 git config bool.false2 "" &&
715 git config bool.false3 nO &&
716 git config bool.false4 FALSE &&
717 rm -f result &&
718 for i in 1 2 3 4
720 git config --bool --get bool.true$i >>result
721 git config --bool --get bool.false$i >>result
722 done &&
723 test_cmp expect result'
725 test_expect_success 'invalid bool (--get)' '
727 git config bool.nobool foobar &&
728 test_must_fail git config --bool --get bool.nobool'
730 test_expect_success 'invalid bool (set)' '
732 test_must_fail git config --bool bool.nobool foobar'
734 cat > expect <<\EOF
735 [bool]
736 true1 = true
737 true2 = true
738 true3 = true
739 true4 = true
740 false1 = false
741 false2 = false
742 false3 = false
743 false4 = false
746 test_expect_success 'set --bool' '
748 rm -f .git/config &&
749 git config --bool bool.true1 01 &&
750 git config --bool bool.true2 -1 &&
751 git config --bool bool.true3 YeS &&
752 git config --bool bool.true4 true &&
753 git config --bool bool.false1 000 &&
754 git config --bool bool.false2 "" &&
755 git config --bool bool.false3 nO &&
756 git config --bool bool.false4 FALSE &&
757 test_cmp expect .git/config'
759 cat > expect <<\EOF
760 [int]
761 val1 = 1
762 val2 = -1
763 val3 = 5242880
766 test_expect_success 'set --int' '
768 rm -f .git/config &&
769 git config --int int.val1 01 &&
770 git config --int int.val2 -1 &&
771 git config --int int.val3 5m &&
772 test_cmp expect .git/config
775 test_expect_success 'get --bool-or-int' '
776 cat >.git/config <<-\EOF &&
777 [bool]
778 true1
779 true2 = true
780 false = false
781 [int]
782 int1 = 0
783 int2 = 1
784 int3 = -1
786 cat >expect <<-\EOF &&
787 true
788 true
789 false
795 git config --bool-or-int bool.true1 &&
796 git config --bool-or-int bool.true2 &&
797 git config --bool-or-int bool.false &&
798 git config --bool-or-int int.int1 &&
799 git config --bool-or-int int.int2 &&
800 git config --bool-or-int int.int3
801 } >actual &&
802 test_cmp expect actual
805 cat >expect <<\EOF
806 [bool]
807 true1 = true
808 false1 = false
809 true2 = true
810 false2 = false
811 [int]
812 int1 = 0
813 int2 = 1
814 int3 = -1
817 test_expect_success 'set --bool-or-int' '
818 rm -f .git/config &&
819 git config --bool-or-int bool.true1 true &&
820 git config --bool-or-int bool.false1 false &&
821 git config --bool-or-int bool.true2 yes &&
822 git config --bool-or-int bool.false2 no &&
823 git config --bool-or-int int.int1 0 &&
824 git config --bool-or-int int.int2 1 &&
825 git config --bool-or-int int.int3 -1 &&
826 test_cmp expect .git/config
829 cat >expect <<\EOF
830 [path]
831 home = ~/
832 normal = /dev/null
833 trailingtilde = foo~
836 test_expect_success !MINGW 'set --path' '
837 rm -f .git/config &&
838 git config --path path.home "~/" &&
839 git config --path path.normal "/dev/null" &&
840 git config --path path.trailingtilde "foo~" &&
841 test_cmp expect .git/config'
843 if test_have_prereq !MINGW && test "${HOME+set}"
844 then
845 test_set_prereq HOMEVAR
848 cat >expect <<EOF
849 $HOME/
850 /dev/null
851 foo~
854 test_expect_success HOMEVAR 'get --path' '
855 git config --get --path path.home > result &&
856 git config --get --path path.normal >> result &&
857 git config --get --path path.trailingtilde >> result &&
858 test_cmp expect result
861 cat >expect <<\EOF
862 /dev/null
863 foo~
866 test_expect_success !MINGW 'get --path copes with unset $HOME' '
868 sane_unset HOME &&
869 test_must_fail git config --get --path path.home \
870 >result 2>msg &&
871 git config --get --path path.normal >>result &&
872 git config --get --path path.trailingtilde >>result
873 ) &&
874 test_i18ngrep "[Ff]ailed to expand.*~/" msg &&
875 test_cmp expect result
878 test_expect_success 'get --path barfs on boolean variable' '
879 echo "[path]bool" >.git/config &&
880 test_must_fail git config --get --path path.bool
883 test_expect_success 'get --expiry-date' '
884 rel="3.weeks.5.days.00:00" &&
885 rel_out="$rel ->" &&
886 cat >.git/config <<-\EOF &&
887 [date]
888 valid1 = "3.weeks.5.days 00:00"
889 valid2 = "Fri Jun 4 15:46:55 2010"
890 valid3 = "2017/11/11 11:11:11PM"
891 valid4 = "2017/11/10 09:08:07 PM"
892 valid5 = "never"
893 invalid1 = "abc"
895 cat >expect <<-EOF &&
896 $(test-tool date timestamp $rel)
897 1275666415
898 1510441871
899 1510348087
902 : "work around heredoc parsing bug fixed in dash 0.5.7 (in ec2c84d)" &&
904 echo "$rel_out $(git config --expiry-date date.valid1)"
905 git config --expiry-date date.valid2 &&
906 git config --expiry-date date.valid3 &&
907 git config --expiry-date date.valid4 &&
908 git config --expiry-date date.valid5
909 } >actual &&
910 test_cmp expect actual &&
911 test_must_fail git config --expiry-date date.invalid1
914 test_expect_success 'get --type=color' '
915 rm .git/config &&
916 git config foo.color "red" &&
917 git config --get --type=color foo.color >actual.raw &&
918 test_decode_color <actual.raw >actual &&
919 echo "<RED>" >expect &&
920 test_cmp expect actual
923 cat >expect << EOF
924 [foo]
925 color = red
928 test_expect_success 'set --type=color' '
929 rm .git/config &&
930 git config --type=color foo.color "red" &&
931 test_cmp expect .git/config
934 test_expect_success 'get --type=color barfs on non-color' '
935 echo "[foo]bar=not-a-color" >.git/config &&
936 test_must_fail git config --get --type=color foo.bar
939 test_expect_success 'set --type=color barfs on non-color' '
940 test_must_fail git config --type=color foo.color "not-a-color" 2>error &&
941 test_i18ngrep "cannot parse color" error
944 cat > expect << EOF
945 [quote]
946 leading = " test"
947 ending = "test "
948 semicolon = "test;test"
949 hash = "test#test"
951 test_expect_success 'quoting' '
952 rm -f .git/config &&
953 git config quote.leading " test" &&
954 git config quote.ending "test " &&
955 git config quote.semicolon "test;test" &&
956 git config quote.hash "test#test" &&
957 test_cmp expect .git/config
960 test_expect_success 'key with newline' '
961 test_must_fail git config "key.with
962 newline" 123'
964 test_expect_success 'value with newline' 'git config key.sub value.with\\\
965 newline'
967 cat > .git/config <<\EOF
968 [section]
969 ; comment \
970 continued = cont\
971 inued
972 noncont = not continued ; \
973 quotecont = "cont;\
974 inued"
977 cat > expect <<\EOF
978 section.continued=continued
979 section.noncont=not continued
980 section.quotecont=cont;inued
983 test_expect_success 'value continued on next line' '
984 git config --list > result &&
985 test_cmp expect result
988 cat > .git/config <<\EOF
989 [section "sub=section"]
990 val1 = foo=bar
991 val2 = foo\nbar
992 val3 = \n\n
993 val4 =
994 val5
997 cat > expect <<\EOF
998 section.sub=section.val1
999 foo=barQsection.sub=section.val2
1001 barQsection.sub=section.val3
1004 Qsection.sub=section.val4
1005 Qsection.sub=section.val5Q
1007 test_expect_success '--null --list' '
1008 git config --null --list >result.raw &&
1009 nul_to_q <result.raw >result &&
1010 echo >>result &&
1011 test_cmp expect result
1014 test_expect_success '--null --get-regexp' '
1015 git config --null --get-regexp "val[0-9]" >result.raw &&
1016 nul_to_q <result.raw >result &&
1017 echo >>result &&
1018 test_cmp expect result
1021 test_expect_success 'inner whitespace kept verbatim' '
1022 git config section.val "foo bar" &&
1023 test_cmp_config "foo bar" section.val
1026 test_expect_success SYMLINKS 'symlinked configuration' '
1027 ln -s notyet myconfig &&
1028 git config --file=myconfig test.frotz nitfol &&
1029 test -h myconfig &&
1030 test -f notyet &&
1031 test "z$(git config --file=notyet test.frotz)" = znitfol &&
1032 git config --file=myconfig test.xyzzy rezrov &&
1033 test -h myconfig &&
1034 test -f notyet &&
1035 cat >expect <<-\EOF &&
1036 nitfol
1037 rezrov
1040 git config --file=notyet test.frotz &&
1041 git config --file=notyet test.xyzzy
1042 } >actual &&
1043 test_cmp expect actual
1046 test_expect_success SYMLINKS 'symlink to nonexistent configuration' '
1047 ln -s doesnotexist linktonada &&
1048 ln -s linktonada linktolinktonada &&
1049 test_must_fail git config --file=linktonada --list &&
1050 test_must_fail git config --file=linktolinktonada --list
1053 test_expect_success 'check split_cmdline return' "
1054 git config alias.split-cmdline-fix 'echo \"' &&
1055 test_must_fail git split-cmdline-fix &&
1056 echo foo > foo &&
1057 git add foo &&
1058 git commit -m 'initial commit' &&
1059 git config branch.main.mergeoptions 'echo \"' &&
1060 test_must_fail git merge main
1063 test_expect_success 'git -c "key=value" support' '
1064 cat >expect <<-\EOF &&
1065 value
1066 value
1067 true
1070 git -c section.name=value config section.name &&
1071 git -c foo.CamelCase=value config foo.camelcase &&
1072 git -c foo.flag config --bool foo.flag
1073 } >actual &&
1074 test_cmp expect actual &&
1075 test_must_fail git -c name=value config section.name
1078 # We just need a type-specifier here that cares about the
1079 # distinction internally between a NULL boolean and a real
1080 # string (because most of git's internal parsers do care).
1081 # Using "--path" works, but we do not otherwise care about
1082 # its semantics.
1083 test_expect_success 'git -c can represent empty string' '
1084 echo >expect &&
1085 git -c foo.empty= config --path foo.empty >actual &&
1086 test_cmp expect actual
1089 test_expect_success 'key sanity-checking' '
1090 test_must_fail git config foo=bar &&
1091 test_must_fail git config foo=.bar &&
1092 test_must_fail git config foo.ba=r &&
1093 test_must_fail git config foo.1bar &&
1094 test_must_fail git config foo."ba
1095 z".bar &&
1096 test_must_fail git config . false &&
1097 test_must_fail git config .foo false &&
1098 test_must_fail git config foo. false &&
1099 test_must_fail git config .foo. false &&
1100 git config foo.bar true &&
1101 git config foo."ba =z".bar false
1104 test_expect_success 'git -c works with aliases of builtins' '
1105 git config alias.checkconfig "-c foo.check=bar config foo.check" &&
1106 echo bar >expect &&
1107 git checkconfig >actual &&
1108 test_cmp expect actual
1111 test_expect_success 'aliases can be CamelCased' '
1112 test_config alias.CamelCased "rev-parse HEAD" &&
1113 git CamelCased >out &&
1114 git rev-parse HEAD >expect &&
1115 test_cmp expect out
1118 test_expect_success 'git -c does not split values on equals' '
1119 echo "value with = in it" >expect &&
1120 git -c section.foo="value with = in it" config section.foo >actual &&
1121 test_cmp expect actual
1124 test_expect_success 'git -c dies on bogus config' '
1125 test_must_fail git -c core.bare=foo rev-parse
1128 test_expect_success 'git -c complains about empty key' '
1129 test_must_fail git -c "=foo" rev-parse
1132 test_expect_success 'git -c complains about empty key and value' '
1133 test_must_fail git -c "" rev-parse
1136 test_expect_success 'multiple git -c appends config' '
1137 test_config alias.x "!git -c x.two=2 config --get-regexp ^x\.*" &&
1138 cat >expect <<-\EOF &&
1139 x.one 1
1140 x.two 2
1142 git -c x.one=1 x >actual &&
1143 test_cmp expect actual
1146 test_expect_success 'last one wins: two level vars' '
1148 # sec.var and sec.VAR are the same variable, as the first
1149 # and the last level of a configuration variable name is
1150 # case insensitive.
1152 echo VAL >expect &&
1154 git -c sec.var=val -c sec.VAR=VAL config --get sec.var >actual &&
1155 test_cmp expect actual &&
1156 git -c SEC.var=val -c sec.var=VAL config --get sec.var >actual &&
1157 test_cmp expect actual &&
1159 git -c sec.var=val -c sec.VAR=VAL config --get SEC.var >actual &&
1160 test_cmp expect actual &&
1161 git -c SEC.var=val -c sec.var=VAL config --get sec.VAR >actual &&
1162 test_cmp expect actual
1165 test_expect_success 'last one wins: three level vars' '
1167 # v.a.r and v.A.r are not the same variable, as the middle
1168 # level of a three-level configuration variable name is
1169 # case sensitive.
1171 echo val >expect &&
1172 git -c v.a.r=val -c v.A.r=VAL config --get v.a.r >actual &&
1173 test_cmp expect actual &&
1174 git -c v.a.r=val -c v.A.r=VAL config --get V.a.R >actual &&
1175 test_cmp expect actual &&
1177 # v.a.r and V.a.R are the same variable, as the first
1178 # and the last level of a configuration variable name is
1179 # case insensitive.
1181 echo VAL >expect &&
1182 git -c v.a.r=val -c v.a.R=VAL config --get v.a.r >actual &&
1183 test_cmp expect actual &&
1184 git -c v.a.r=val -c V.a.r=VAL config --get v.a.r >actual &&
1185 test_cmp expect actual &&
1186 git -c v.a.r=val -c v.a.R=VAL config --get V.a.R >actual &&
1187 test_cmp expect actual &&
1188 git -c v.a.r=val -c V.a.r=VAL config --get V.a.R >actual &&
1189 test_cmp expect actual
1192 test_expect_success 'old-fashioned settings are case insensitive' '
1193 test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
1195 cat >testConfig_actual <<-EOF &&
1196 [V.A]
1197 r = value1
1199 q_to_tab >testConfig_expect <<-EOF &&
1200 [V.A]
1201 Qr = value2
1203 git config -f testConfig_actual "v.a.r" value2 &&
1204 test_cmp testConfig_expect testConfig_actual &&
1206 cat >testConfig_actual <<-EOF &&
1207 [V.A]
1208 r = value1
1210 q_to_tab >testConfig_expect <<-EOF &&
1211 [V.A]
1212 QR = value2
1214 git config -f testConfig_actual "V.a.R" value2 &&
1215 test_cmp testConfig_expect testConfig_actual &&
1217 cat >testConfig_actual <<-EOF &&
1218 [V.A]
1219 r = value1
1221 q_to_tab >testConfig_expect <<-EOF &&
1222 [V.A]
1223 r = value1
1224 Qr = value2
1226 git config -f testConfig_actual "V.A.r" value2 &&
1227 test_cmp testConfig_expect testConfig_actual &&
1229 cat >testConfig_actual <<-EOF &&
1230 [V.A]
1231 r = value1
1233 q_to_tab >testConfig_expect <<-EOF &&
1234 [V.A]
1235 r = value1
1236 Qr = value2
1238 git config -f testConfig_actual "v.A.r" value2 &&
1239 test_cmp testConfig_expect testConfig_actual
1242 test_expect_success 'setting different case sensitive subsections ' '
1243 test_when_finished "rm -f testConfig testConfig_expect testConfig_actual" &&
1245 cat >testConfig_actual <<-EOF &&
1246 [V "A"]
1247 R = v1
1248 [K "E"]
1249 Y = v1
1250 [a "b"]
1251 c = v1
1252 [d "e"]
1253 f = v1
1255 q_to_tab >testConfig_expect <<-EOF &&
1256 [V "A"]
1257 Qr = v2
1258 [K "E"]
1259 Qy = v2
1260 [a "b"]
1261 Qc = v2
1262 [d "e"]
1263 f = v1
1264 [d "E"]
1265 Qf = v2
1267 # exact match
1268 git config -f testConfig_actual a.b.c v2 &&
1269 # match section and subsection, key is cased differently.
1270 git config -f testConfig_actual K.E.y v2 &&
1271 # section and key are matched case insensitive, but subsection needs
1272 # to match; When writing out new values only the key is adjusted
1273 git config -f testConfig_actual v.A.r v2 &&
1274 # subsection is not matched:
1275 git config -f testConfig_actual d.E.f v2 &&
1276 test_cmp testConfig_expect testConfig_actual
1279 for VAR in a .a a. a.0b a."b c". a."b c".0d
1281 test_expect_success "git -c $VAR=VAL rejects invalid '$VAR'" '
1282 test_must_fail git -c "$VAR=VAL" config -l
1284 done
1286 for VAR in a.b a."b c".d
1288 test_expect_success "git -c $VAR=VAL works with valid '$VAR'" '
1289 echo VAL >expect &&
1290 git -c "$VAR=VAL" config --get "$VAR" >actual &&
1291 test_cmp expect actual
1293 done
1295 test_expect_success 'git -c is not confused by empty environment' '
1296 GIT_CONFIG_PARAMETERS="" git -c x.one=1 config --list
1299 test_expect_success 'GIT_CONFIG_PARAMETERS handles old-style entries' '
1300 v="${SQ}key.one=foo${SQ}" &&
1301 v="$v ${SQ}key.two=bar${SQ}" &&
1302 v="$v ${SQ}key.ambiguous=section.whatever=value${SQ}" &&
1303 GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
1304 cat >expect <<-EOF &&
1305 key.one foo
1306 key.two bar
1307 key.ambiguous section.whatever=value
1309 test_cmp expect actual
1312 test_expect_success 'GIT_CONFIG_PARAMETERS handles new-style entries' '
1313 v="${SQ}key.one${SQ}=${SQ}foo${SQ}" &&
1314 v="$v ${SQ}key.two${SQ}=${SQ}bar${SQ}" &&
1315 v="$v ${SQ}key.ambiguous=section.whatever${SQ}=${SQ}value${SQ}" &&
1316 GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
1317 cat >expect <<-EOF &&
1318 key.one foo
1319 key.two bar
1320 key.ambiguous=section.whatever value
1322 test_cmp expect actual
1325 test_expect_success 'old and new-style entries can mix' '
1326 v="${SQ}key.oldone=oldfoo${SQ}" &&
1327 v="$v ${SQ}key.newone${SQ}=${SQ}newfoo${SQ}" &&
1328 v="$v ${SQ}key.oldtwo=oldbar${SQ}" &&
1329 v="$v ${SQ}key.newtwo${SQ}=${SQ}newbar${SQ}" &&
1330 GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
1331 cat >expect <<-EOF &&
1332 key.oldone oldfoo
1333 key.newone newfoo
1334 key.oldtwo oldbar
1335 key.newtwo newbar
1337 test_cmp expect actual
1340 test_expect_success 'old and new bools with ambiguous subsection' '
1341 v="${SQ}key.with=equals.oldbool${SQ}" &&
1342 v="$v ${SQ}key.with=equals.newbool${SQ}=" &&
1343 GIT_CONFIG_PARAMETERS=$v git config --get-regexp "key.*" >actual &&
1344 cat >expect <<-EOF &&
1345 key.with equals.oldbool
1346 key.with=equals.newbool
1348 test_cmp expect actual
1351 test_expect_success 'detect bogus GIT_CONFIG_PARAMETERS' '
1352 cat >expect <<-\EOF &&
1353 env.one one
1354 env.two two
1356 GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ} ${SQ}env.two=two${SQ}" \
1357 git config --get-regexp "env.*" >actual &&
1358 test_cmp expect actual &&
1360 cat >expect <<-EOF &&
1361 env.one one${SQ}
1362 env.two two
1364 GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ$SQ$SQ ${SQ}env.two=two${SQ}" \
1365 git config --get-regexp "env.*" >actual &&
1366 test_cmp expect actual &&
1368 test_must_fail env \
1369 GIT_CONFIG_PARAMETERS="${SQ}env.one=one${SQ}\\$SQ ${SQ}env.two=two${SQ}" \
1370 git config --get-regexp "env.*"
1373 test_expect_success 'git --config-env=key=envvar support' '
1374 cat >expect <<-\EOF &&
1375 value
1376 value
1377 value
1378 value
1379 false
1380 false
1383 ENVVAR=value git --config-env=core.name=ENVVAR config core.name &&
1384 ENVVAR=value git --config-env core.name=ENVVAR config core.name &&
1385 ENVVAR=value git --config-env=foo.CamelCase=ENVVAR config foo.camelcase &&
1386 ENVVAR=value git --config-env foo.CamelCase=ENVVAR config foo.camelcase &&
1387 ENVVAR= git --config-env=foo.flag=ENVVAR config --bool foo.flag &&
1388 ENVVAR= git --config-env foo.flag=ENVVAR config --bool foo.flag
1389 } >actual &&
1390 test_cmp expect actual
1393 test_expect_success 'git --config-env with missing value' '
1394 test_must_fail env ENVVAR=value git --config-env 2>error &&
1395 grep "no config key given for --config-env" error &&
1396 test_must_fail env ENVVAR=value git --config-env config core.name 2>error &&
1397 grep "invalid config format: config" error
1400 test_expect_success 'git --config-env fails with invalid parameters' '
1401 test_must_fail git --config-env=foo.flag config --bool foo.flag 2>error &&
1402 test_i18ngrep "invalid config format: foo.flag" error &&
1403 test_must_fail git --config-env=foo.flag= config --bool foo.flag 2>error &&
1404 test_i18ngrep "missing environment variable name for configuration ${SQ}foo.flag${SQ}" error &&
1405 sane_unset NONEXISTENT &&
1406 test_must_fail git --config-env=foo.flag=NONEXISTENT config --bool foo.flag 2>error &&
1407 test_i18ngrep "missing environment variable ${SQ}NONEXISTENT${SQ} for configuration ${SQ}foo.flag${SQ}" error
1410 test_expect_success 'git -c and --config-env work together' '
1411 cat >expect <<-\EOF &&
1412 bar.cmd cmd-value
1413 bar.env env-value
1415 ENVVAR=env-value git \
1416 -c bar.cmd=cmd-value \
1417 --config-env=bar.env=ENVVAR \
1418 config --get-regexp "^bar.*" >actual &&
1419 test_cmp expect actual
1422 test_expect_success 'git -c and --config-env override each other' '
1423 cat >expect <<-\EOF &&
1428 ENVVAR=env git -c bar.bar=cmd --config-env=bar.bar=ENVVAR config bar.bar &&
1429 ENVVAR=env git --config-env=bar.bar=ENVVAR -c bar.bar=cmd config bar.bar
1430 } >actual &&
1431 test_cmp expect actual
1434 test_expect_success '--config-env handles keys with equals' '
1435 echo value=with=equals >expect &&
1436 ENVVAR=value=with=equals git \
1437 --config-env=section.subsection=with=equals.key=ENVVAR \
1438 config section.subsection=with=equals.key >actual &&
1439 test_cmp expect actual
1442 test_expect_success 'git config handles environment config pairs' '
1443 GIT_CONFIG_COUNT=2 \
1444 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="foo" \
1445 GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="bar" \
1446 git config --get-regexp "pair.*" >actual &&
1447 cat >expect <<-EOF &&
1448 pair.one foo
1449 pair.two bar
1451 test_cmp expect actual
1454 test_expect_success 'git config ignores pairs without count' '
1455 test_must_fail env GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1456 git config pair.one 2>error &&
1457 test_must_be_empty error
1460 test_expect_success 'git config ignores pairs with zero count' '
1461 test_must_fail env \
1462 GIT_CONFIG_COUNT=0 \
1463 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1464 git config pair.one
1467 test_expect_success 'git config ignores pairs exceeding count' '
1468 GIT_CONFIG_COUNT=1 \
1469 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1470 GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="value" \
1471 git config --get-regexp "pair.*" >actual &&
1472 cat >expect <<-EOF &&
1473 pair.one value
1475 test_cmp expect actual
1478 test_expect_success 'git config ignores pairs with zero count' '
1479 test_must_fail env \
1480 GIT_CONFIG_COUNT=0 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1481 git config pair.one >error &&
1482 test_must_be_empty error
1485 test_expect_success 'git config ignores pairs with empty count' '
1486 test_must_fail env \
1487 GIT_CONFIG_COUNT= GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
1488 git config pair.one >error &&
1489 test_must_be_empty error
1492 test_expect_success 'git config fails with invalid count' '
1493 test_must_fail env GIT_CONFIG_COUNT=10a git config --list 2>error &&
1494 test_i18ngrep "bogus count" error &&
1495 test_must_fail env GIT_CONFIG_COUNT=9999999999999999 git config --list 2>error &&
1496 test_i18ngrep "too many entries" error
1499 test_expect_success 'git config fails with missing config key' '
1500 test_must_fail env GIT_CONFIG_COUNT=1 GIT_CONFIG_VALUE_0="value" \
1501 git config --list 2>error &&
1502 test_i18ngrep "missing config key" error
1505 test_expect_success 'git config fails with missing config value' '
1506 test_must_fail env GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0="pair.one" \
1507 git config --list 2>error &&
1508 test_i18ngrep "missing config value" error
1511 test_expect_success 'git config fails with invalid config pair key' '
1512 test_must_fail env GIT_CONFIG_COUNT=1 \
1513 GIT_CONFIG_KEY_0= GIT_CONFIG_VALUE_0=value \
1514 git config --list &&
1515 test_must_fail env GIT_CONFIG_COUNT=1 \
1516 GIT_CONFIG_KEY_0=missing-section GIT_CONFIG_VALUE_0=value \
1517 git config --list
1520 test_expect_success 'environment overrides config file' '
1521 test_when_finished "rm -f .git/config" &&
1522 cat >.git/config <<-EOF &&
1523 [pair]
1524 one = value
1526 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=pair.one GIT_CONFIG_VALUE_0=override \
1527 git config pair.one >actual &&
1528 cat >expect <<-EOF &&
1529 override
1531 test_cmp expect actual
1534 test_expect_success 'GIT_CONFIG_PARAMETERS overrides environment config' '
1535 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=pair.one GIT_CONFIG_VALUE_0=value \
1536 GIT_CONFIG_PARAMETERS="${SQ}pair.one=override${SQ}" \
1537 git config pair.one >actual &&
1538 cat >expect <<-EOF &&
1539 override
1541 test_cmp expect actual
1544 test_expect_success 'command line overrides environment config' '
1545 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=pair.one GIT_CONFIG_VALUE_0=value \
1546 git -c pair.one=override config pair.one >actual &&
1547 cat >expect <<-EOF &&
1548 override
1550 test_cmp expect actual
1553 test_expect_success 'git config --edit works' '
1554 git config -f tmp test.value no &&
1555 echo test.value=yes >expect &&
1556 GIT_EDITOR="echo [test]value=yes >" git config -f tmp --edit &&
1557 git config -f tmp --list >actual &&
1558 test_cmp expect actual
1561 test_expect_success 'git config --edit respects core.editor' '
1562 git config -f tmp test.value no &&
1563 echo test.value=yes >expect &&
1564 test_config core.editor "echo [test]value=yes >" &&
1565 git config -f tmp --edit &&
1566 git config -f tmp --list >actual &&
1567 test_cmp expect actual
1570 # malformed configuration files
1571 test_expect_success 'barf on syntax error' '
1572 cat >.git/config <<-\EOF &&
1573 # broken section line
1574 [section]
1575 key garbage
1577 test_must_fail git config --get section.key >actual 2>error &&
1578 test_i18ngrep " line 3 " error
1581 test_expect_success 'barf on incomplete section header' '
1582 cat >.git/config <<-\EOF &&
1583 # broken section line
1584 [section
1585 key = value
1587 test_must_fail git config --get section.key >actual 2>error &&
1588 test_i18ngrep " line 2 " error
1591 test_expect_success 'barf on incomplete string' '
1592 cat >.git/config <<-\EOF &&
1593 # broken section line
1594 [section]
1595 key = "value string
1597 test_must_fail git config --get section.key >actual 2>error &&
1598 test_i18ngrep " line 3 " error
1601 test_expect_success 'urlmatch' '
1602 cat >.git/config <<-\EOF &&
1603 [http]
1604 sslVerify
1605 [http "https://weak.example.com"]
1606 sslVerify = false
1607 cookieFile = /tmp/cookie.txt
1610 test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
1611 test_must_be_empty actual &&
1613 echo true >expect &&
1614 git config --bool --get-urlmatch http.SSLverify https://good.example.com >actual &&
1615 test_cmp expect actual &&
1617 echo false >expect &&
1618 git config --bool --get-urlmatch http.sslverify https://weak.example.com >actual &&
1619 test_cmp expect actual &&
1622 echo http.cookiefile /tmp/cookie.txt &&
1623 echo http.sslverify false
1624 } >expect &&
1625 git config --get-urlmatch HTTP https://weak.example.com >actual &&
1626 test_cmp expect actual
1629 test_expect_success 'urlmatch favors more specific URLs' '
1630 cat >.git/config <<-\EOF &&
1631 [http "https://example.com/"]
1632 cookieFile = /tmp/root.txt
1633 [http "https://example.com/subdirectory"]
1634 cookieFile = /tmp/subdirectory.txt
1635 [http "https://user@example.com/"]
1636 cookieFile = /tmp/user.txt
1637 [http "https://averylonguser@example.com/"]
1638 cookieFile = /tmp/averylonguser.txt
1639 [http "https://preceding.example.com"]
1640 cookieFile = /tmp/preceding.txt
1641 [http "https://*.example.com"]
1642 cookieFile = /tmp/wildcard.txt
1643 [http "https://*.example.com/wildcardwithsubdomain"]
1644 cookieFile = /tmp/wildcardwithsubdomain.txt
1645 [http "https://*.example.*"]
1646 cookieFile = /tmp/multiwildcard.txt
1647 [http "https://trailing.example.com"]
1648 cookieFile = /tmp/trailing.txt
1649 [http "https://user@*.example.com/"]
1650 cookieFile = /tmp/wildcardwithuser.txt
1651 [http "https://sub.example.com/"]
1652 cookieFile = /tmp/sub.txt
1655 echo http.cookiefile /tmp/root.txt >expect &&
1656 git config --get-urlmatch HTTP https://example.com >actual &&
1657 test_cmp expect actual &&
1659 echo http.cookiefile /tmp/subdirectory.txt >expect &&
1660 git config --get-urlmatch HTTP https://example.com/subdirectory >actual &&
1661 test_cmp expect actual &&
1663 echo http.cookiefile /tmp/subdirectory.txt >expect &&
1664 git config --get-urlmatch HTTP https://example.com/subdirectory/nested >actual &&
1665 test_cmp expect actual &&
1667 echo http.cookiefile /tmp/user.txt >expect &&
1668 git config --get-urlmatch HTTP https://user@example.com/ >actual &&
1669 test_cmp expect actual &&
1671 echo http.cookiefile /tmp/subdirectory.txt >expect &&
1672 git config --get-urlmatch HTTP https://averylonguser@example.com/subdirectory >actual &&
1673 test_cmp expect actual &&
1675 echo http.cookiefile /tmp/preceding.txt >expect &&
1676 git config --get-urlmatch HTTP https://preceding.example.com >actual &&
1677 test_cmp expect actual &&
1679 echo http.cookiefile /tmp/wildcard.txt >expect &&
1680 git config --get-urlmatch HTTP https://wildcard.example.com >actual &&
1681 test_cmp expect actual &&
1683 echo http.cookiefile /tmp/sub.txt >expect &&
1684 git config --get-urlmatch HTTP https://sub.example.com/wildcardwithsubdomain >actual &&
1685 test_cmp expect actual &&
1687 echo http.cookiefile /tmp/trailing.txt >expect &&
1688 git config --get-urlmatch HTTP https://trailing.example.com >actual &&
1689 test_cmp expect actual &&
1691 echo http.cookiefile /tmp/sub.txt >expect &&
1692 git config --get-urlmatch HTTP https://user@sub.example.com >actual &&
1693 test_cmp expect actual &&
1695 echo http.cookiefile /tmp/multiwildcard.txt >expect &&
1696 git config --get-urlmatch HTTP https://wildcard.example.org >actual &&
1697 test_cmp expect actual
1700 test_expect_success 'urlmatch with wildcard' '
1701 cat >.git/config <<-\EOF &&
1702 [http]
1703 sslVerify
1704 [http "https://*.example.com"]
1705 sslVerify = false
1706 cookieFile = /tmp/cookie.txt
1709 test_expect_code 1 git config --bool --get-urlmatch doesnt.exist https://good.example.com >actual &&
1710 test_must_be_empty actual &&
1712 echo true >expect &&
1713 git config --bool --get-urlmatch http.SSLverify https://example.com >actual &&
1714 test_cmp expect actual &&
1716 echo true >expect &&
1717 git config --bool --get-urlmatch http.SSLverify https://good-example.com >actual &&
1718 test_cmp expect actual &&
1720 echo true >expect &&
1721 git config --bool --get-urlmatch http.sslverify https://deep.nested.example.com >actual &&
1722 test_cmp expect actual &&
1724 echo false >expect &&
1725 git config --bool --get-urlmatch http.sslverify https://good.example.com >actual &&
1726 test_cmp expect actual &&
1729 echo http.cookiefile /tmp/cookie.txt &&
1730 echo http.sslverify false
1731 } >expect &&
1732 git config --get-urlmatch HTTP https://good.example.com >actual &&
1733 test_cmp expect actual &&
1735 echo http.sslverify >expect &&
1736 git config --get-urlmatch HTTP https://more.example.com.au >actual &&
1737 test_cmp expect actual
1740 # good section hygiene
1741 test_expect_success '--unset last key removes section (except if commented)' '
1742 cat >.git/config <<-\EOF &&
1743 # some generic comment on the configuration file itself
1744 # a comment specific to this "section" section.
1745 [section]
1746 # some intervening lines
1747 # that should also be dropped
1749 key = value
1750 # please be careful when you update the above variable
1753 cat >expect <<-\EOF &&
1754 # some generic comment on the configuration file itself
1755 # a comment specific to this "section" section.
1756 [section]
1757 # some intervening lines
1758 # that should also be dropped
1760 # please be careful when you update the above variable
1763 git config --unset section.key &&
1764 test_cmp expect .git/config &&
1766 cat >.git/config <<-\EOF &&
1767 [section]
1768 key = value
1769 [next-section]
1772 cat >expect <<-\EOF &&
1773 [next-section]
1776 git config --unset section.key &&
1777 test_cmp expect .git/config &&
1779 q_to_tab >.git/config <<-\EOF &&
1780 [one]
1781 Qkey = "multiline \
1782 QQ# with comment"
1783 [two]
1784 key = true
1786 git config --unset two.key &&
1787 ! grep two .git/config &&
1789 q_to_tab >.git/config <<-\EOF &&
1790 [one]
1791 Qkey = "multiline \
1792 QQ# with comment"
1793 [one]
1794 key = true
1796 git config --unset-all one.key &&
1797 test_line_count = 0 .git/config &&
1799 q_to_tab >.git/config <<-\EOF &&
1800 [one]
1801 Qkey = true
1802 Q# a comment not at the start
1803 [two]
1804 Qkey = true
1806 git config --unset two.key &&
1807 grep two .git/config &&
1809 q_to_tab >.git/config <<-\EOF &&
1810 [one]
1811 Qkey = not [two "subsection"]
1812 [two "subsection"]
1813 [two "subsection"]
1814 Qkey = true
1815 [TWO "subsection"]
1816 [one]
1818 git config --unset two.subsection.key &&
1819 test "not [two subsection]" = "$(git config one.key)" &&
1820 test_line_count = 3 .git/config
1823 test_expect_success '--unset-all removes section if empty & uncommented' '
1824 cat >.git/config <<-\EOF &&
1825 [section]
1826 key = value1
1827 key = value2
1830 git config --unset-all section.key &&
1831 test_line_count = 0 .git/config
1834 test_expect_success 'adding a key into an empty section reuses header' '
1835 cat >.git/config <<-\EOF &&
1836 [section]
1839 q_to_tab >expect <<-\EOF &&
1840 [section]
1841 Qkey = value
1844 git config section.key value &&
1845 test_cmp expect .git/config
1848 test_expect_success POSIXPERM,PERL 'preserves existing permissions' '
1849 chmod 0600 .git/config &&
1850 git config imap.pass Hunter2 &&
1851 perl -e \
1852 "die q(badset) if ((stat(q(.git/config)))[2] & 07777) != 0600" &&
1853 git config --rename-section imap pop &&
1854 perl -e \
1855 "die q(badrename) if ((stat(q(.git/config)))[2] & 07777) != 0600"
1858 ! test_have_prereq MINGW ||
1859 HOME="$(pwd)" # convert to Windows path
1861 test_expect_success 'set up --show-origin tests' '
1862 INCLUDE_DIR="$HOME/include" &&
1863 mkdir -p "$INCLUDE_DIR" &&
1864 cat >"$INCLUDE_DIR"/absolute.include <<-\EOF &&
1865 [user]
1866 absolute = include
1868 cat >"$INCLUDE_DIR"/relative.include <<-\EOF &&
1869 [user]
1870 relative = include
1872 cat >"$HOME"/.gitconfig <<-EOF &&
1873 [user]
1874 global = true
1875 override = global
1876 [include]
1877 path = "$INCLUDE_DIR/absolute.include"
1879 cat >.git/config <<-\EOF
1880 [user]
1881 local = true
1882 override = local
1883 [include]
1884 path = ../include/relative.include
1888 test_expect_success '--show-origin with --list' '
1889 cat >expect <<-EOF &&
1890 file:$HOME/.gitconfig user.global=true
1891 file:$HOME/.gitconfig user.override=global
1892 file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include
1893 file:$INCLUDE_DIR/absolute.include user.absolute=include
1894 file:.git/config user.local=true
1895 file:.git/config user.override=local
1896 file:.git/config include.path=../include/relative.include
1897 file:.git/../include/relative.include user.relative=include
1898 command line: user.environ=true
1899 command line: user.cmdline=true
1901 GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=user.environ GIT_CONFIG_VALUE_0=true\
1902 git -c user.cmdline=true config --list --show-origin >output &&
1903 test_cmp expect output
1906 test_expect_success '--show-origin with --list --null' '
1907 cat >expect <<-EOF &&
1908 file:$HOME/.gitconfigQuser.global
1909 trueQfile:$HOME/.gitconfigQuser.override
1910 globalQfile:$HOME/.gitconfigQinclude.path
1911 $INCLUDE_DIR/absolute.includeQfile:$INCLUDE_DIR/absolute.includeQuser.absolute
1912 includeQfile:.git/configQuser.local
1913 trueQfile:.git/configQuser.override
1914 localQfile:.git/configQinclude.path
1915 ../include/relative.includeQfile:.git/../include/relative.includeQuser.relative
1916 includeQcommand line:Quser.cmdline
1917 trueQ
1919 git -c user.cmdline=true config --null --list --show-origin >output.raw &&
1920 nul_to_q <output.raw >output &&
1921 # The here-doc above adds a newline that the --null output would not
1922 # include. Add it here to make the two comparable.
1923 echo >>output &&
1924 test_cmp expect output
1927 test_expect_success '--show-origin with single file' '
1928 cat >expect <<-\EOF &&
1929 file:.git/config user.local=true
1930 file:.git/config user.override=local
1931 file:.git/config include.path=../include/relative.include
1933 git config --local --list --show-origin >output &&
1934 test_cmp expect output
1937 test_expect_success '--show-origin with --get-regexp' '
1938 cat >expect <<-EOF &&
1939 file:$HOME/.gitconfig user.global true
1940 file:.git/config user.local true
1942 git config --show-origin --get-regexp "user\.[g|l].*" >output &&
1943 test_cmp expect output
1946 test_expect_success '--show-origin getting a single key' '
1947 cat >expect <<-\EOF &&
1948 file:.git/config local
1950 git config --show-origin user.override >output &&
1951 test_cmp expect output
1954 test_expect_success 'set up custom config file' '
1955 CUSTOM_CONFIG_FILE="custom.conf" &&
1956 cat >"$CUSTOM_CONFIG_FILE" <<-\EOF
1957 [user]
1958 custom = true
1962 test_expect_success !MINGW 'set up custom config file with special name characters' '
1963 WEIRDLY_NAMED_FILE="file\" (dq) and spaces.conf" &&
1964 cp "$CUSTOM_CONFIG_FILE" "$WEIRDLY_NAMED_FILE"
1967 test_expect_success !MINGW '--show-origin escape special file name characters' '
1968 cat >expect <<-\EOF &&
1969 file:"file\" (dq) and spaces.conf" user.custom=true
1971 git config --file "$WEIRDLY_NAMED_FILE" --show-origin --list >output &&
1972 test_cmp expect output
1975 test_expect_success '--show-origin stdin' '
1976 cat >expect <<-\EOF &&
1977 standard input: user.custom=true
1979 git config --file - --show-origin --list <"$CUSTOM_CONFIG_FILE" >output &&
1980 test_cmp expect output
1983 test_expect_success '--show-origin stdin with file include' '
1984 cat >"$INCLUDE_DIR"/stdin.include <<-EOF &&
1985 [user]
1986 stdin = include
1988 cat >expect <<-EOF &&
1989 file:$INCLUDE_DIR/stdin.include include
1991 echo "[include]path=\"$INCLUDE_DIR\"/stdin.include" |
1992 git config --show-origin --includes --file - user.stdin >output &&
1994 test_cmp expect output
1997 test_expect_success '--show-origin blob' '
1998 blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
1999 cat >expect <<-EOF &&
2000 blob:$blob user.custom=true
2002 git config --blob=$blob --show-origin --list >output &&
2003 test_cmp expect output
2006 test_expect_success '--show-origin blob ref' '
2007 cat >expect <<-\EOF &&
2008 blob:main:custom.conf user.custom=true
2010 git add "$CUSTOM_CONFIG_FILE" &&
2011 git commit -m "new config file" &&
2012 git config --blob=main:"$CUSTOM_CONFIG_FILE" --show-origin --list >output &&
2013 test_cmp expect output
2016 test_expect_success '--show-scope with --list' '
2017 cat >expect <<-EOF &&
2018 global user.global=true
2019 global user.override=global
2020 global include.path=$INCLUDE_DIR/absolute.include
2021 global user.absolute=include
2022 local user.local=true
2023 local user.override=local
2024 local include.path=../include/relative.include
2025 local user.relative=include
2026 command user.cmdline=true
2028 git -c user.cmdline=true config --list --show-scope >output &&
2029 test_cmp expect output
2032 test_expect_success !MINGW '--show-scope with --blob' '
2033 blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
2034 cat >expect <<-EOF &&
2035 command user.custom=true
2037 git config --blob=$blob --show-scope --list >output &&
2038 test_cmp expect output
2041 test_expect_success '--show-scope with --local' '
2042 cat >expect <<-\EOF &&
2043 local user.local=true
2044 local user.override=local
2045 local include.path=../include/relative.include
2047 git config --local --list --show-scope >output &&
2048 test_cmp expect output
2051 test_expect_success '--show-scope getting a single value' '
2052 cat >expect <<-\EOF &&
2053 local true
2055 git config --show-scope --get user.local >output &&
2056 test_cmp expect output
2059 test_expect_success '--show-scope with --show-origin' '
2060 cat >expect <<-EOF &&
2061 global file:$HOME/.gitconfig user.global=true
2062 global file:$HOME/.gitconfig user.override=global
2063 global file:$HOME/.gitconfig include.path=$INCLUDE_DIR/absolute.include
2064 global file:$INCLUDE_DIR/absolute.include user.absolute=include
2065 local file:.git/config user.local=true
2066 local file:.git/config user.override=local
2067 local file:.git/config include.path=../include/relative.include
2068 local file:.git/../include/relative.include user.relative=include
2069 command command line: user.cmdline=true
2071 git -c user.cmdline=true config --list --show-origin --show-scope >output &&
2072 test_cmp expect output
2075 test_expect_success 'override global and system config' '
2076 test_when_finished rm -f "$HOME"/.config/git &&
2078 cat >"$HOME"/.gitconfig <<-EOF &&
2079 [home]
2080 config = true
2082 mkdir -p "$HOME"/.config/git &&
2083 cat >"$HOME"/.config/git/config <<-EOF &&
2084 [xdg]
2085 config = true
2087 cat >.git/config <<-EOF &&
2088 [local]
2089 config = true
2091 cat >custom-global-config <<-EOF &&
2092 [global]
2093 config = true
2095 cat >custom-system-config <<-EOF &&
2096 [system]
2097 config = true
2100 cat >expect <<-EOF &&
2101 global xdg.config=true
2102 global home.config=true
2103 local local.config=true
2105 git config --show-scope --list >output &&
2106 test_cmp expect output &&
2108 cat >expect <<-EOF &&
2109 system system.config=true
2110 global global.config=true
2111 local local.config=true
2113 GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=custom-system-config GIT_CONFIG_GLOBAL=custom-global-config \
2114 git config --show-scope --list >output &&
2115 test_cmp expect output &&
2117 cat >expect <<-EOF &&
2118 local local.config=true
2120 GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=/dev/null GIT_CONFIG_GLOBAL=/dev/null \
2121 git config --show-scope --list >output &&
2122 test_cmp expect output
2125 test_expect_success 'override global and system config with missing file' '
2126 test_must_fail env GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=/dev/null git config --global --list &&
2127 test_must_fail env GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=does-not-exist git config --system --list &&
2128 GIT_CONFIG_GLOBAL=does-not-exist GIT_CONFIG_SYSTEM=does-not-exist git version
2131 test_expect_success 'system override has no effect with GIT_CONFIG_NOSYSTEM' '
2132 # `git config --system` has different semantics compared to other
2133 # commands as it ignores GIT_CONFIG_NOSYSTEM. We thus test whether the
2134 # variable has an effect via a different proxy.
2135 cat >alias-config <<-EOF &&
2136 [alias]
2137 hello-world = !echo "hello world"
2139 test_must_fail env GIT_CONFIG_NOSYSTEM=true GIT_CONFIG_SYSTEM=alias-config \
2140 git hello-world &&
2141 GIT_CONFIG_NOSYSTEM=false GIT_CONFIG_SYSTEM=alias-config \
2142 git hello-world >actual &&
2143 echo "hello world" >expect &&
2144 test_cmp expect actual
2147 test_expect_success 'write to overridden global and system config' '
2148 cat >expect <<EOF &&
2149 [config]
2150 key = value
2153 GIT_CONFIG_GLOBAL=write-to-global git config --global config.key value &&
2154 test_cmp expect write-to-global &&
2156 GIT_CONFIG_SYSTEM=write-to-system git config --system config.key value &&
2157 test_cmp expect write-to-system
2160 for opt in --local --worktree
2162 test_expect_success "$opt requires a repo" '
2163 # we expect 128 to ensure that we do not simply
2164 # fail to find anything and return code "1"
2165 test_expect_code 128 nongit git config $opt foo.bar
2167 done
2169 cat >.git/config <<-\EOF &&
2170 [section]
2171 foo = true
2172 number = 10
2173 big = 1M
2176 test_expect_success 'identical modern --type specifiers are allowed' '
2177 test_cmp_config 1048576 --type=int --type=int section.big
2180 test_expect_success 'identical legacy --type specifiers are allowed' '
2181 test_cmp_config 1048576 --int --int section.big
2184 test_expect_success 'identical mixed --type specifiers are allowed' '
2185 test_cmp_config 1048576 --int --type=int section.big
2188 test_expect_success 'non-identical modern --type specifiers are not allowed' '
2189 test_must_fail git config --type=int --type=bool section.big 2>error &&
2190 test_i18ngrep "only one type at a time" error
2193 test_expect_success 'non-identical legacy --type specifiers are not allowed' '
2194 test_must_fail git config --int --bool section.big 2>error &&
2195 test_i18ngrep "only one type at a time" error
2198 test_expect_success 'non-identical mixed --type specifiers are not allowed' '
2199 test_must_fail git config --type=int --bool section.big 2>error &&
2200 test_i18ngrep "only one type at a time" error
2203 test_expect_success '--type allows valid type specifiers' '
2204 test_cmp_config true --type=bool section.foo
2207 test_expect_success '--no-type unsets type specifiers' '
2208 test_cmp_config 10 --type=bool --no-type section.number
2211 test_expect_success 'unset type specifiers may be reset to conflicting ones' '
2212 test_cmp_config 1048576 --type=bool --no-type --type=int section.big
2215 test_expect_success '--type rejects unknown specifiers' '
2216 test_must_fail git config --type=nonsense section.foo 2>error &&
2217 test_i18ngrep "unrecognized --type argument" error
2220 test_expect_success '--replace-all does not invent newlines' '
2221 q_to_tab >.git/config <<-\EOF &&
2222 [abc]key
2223 QkeepSection
2224 [xyz]
2225 Qkey = 1
2226 [abc]
2227 Qkey = a
2229 q_to_tab >expect <<-\EOF &&
2230 [abc]
2231 QkeepSection
2232 [xyz]
2233 Qkey = 1
2234 [abc]
2235 Qkey = b
2237 git config --replace-all abc.key b &&
2238 test_cmp expect .git/config
2241 test_expect_success 'set all config with value-pattern' '
2242 test_when_finished rm -f config initial &&
2243 git config --file=initial abc.key one &&
2245 # no match => add new entry
2246 cp initial config &&
2247 git config --file=config abc.key two a+ &&
2248 git config --file=config --list >actual &&
2249 cat >expect <<-\EOF &&
2250 abc.key=one
2251 abc.key=two
2253 test_cmp expect actual &&
2255 # multiple matches => failure
2256 test_must_fail git config --file=config abc.key three o+ 2>err &&
2257 test_i18ngrep "has multiple values" err &&
2259 # multiple values, no match => add
2260 git config --file=config abc.key three a+ &&
2261 git config --file=config --list >actual &&
2262 cat >expect <<-\EOF &&
2263 abc.key=one
2264 abc.key=two
2265 abc.key=three
2267 test_cmp expect actual &&
2269 # single match => replace
2270 git config --file=config abc.key four h+ &&
2271 git config --file=config --list >actual &&
2272 cat >expect <<-\EOF &&
2273 abc.key=one
2274 abc.key=two
2275 abc.key=four
2277 test_cmp expect actual
2280 test_expect_success '--replace-all and value-pattern' '
2281 test_when_finished rm -f config &&
2282 git config --file=config --add abc.key one &&
2283 git config --file=config --add abc.key two &&
2284 git config --file=config --add abc.key three &&
2285 git config --file=config --replace-all abc.key four "o+" &&
2286 git config --file=config --list >actual &&
2287 cat >expect <<-\EOF &&
2288 abc.key=four
2289 abc.key=three
2291 test_cmp expect actual
2294 test_expect_success 'refuse --fixed-value for incompatible actions' '
2295 test_when_finished rm -f config &&
2296 git config --file=config dev.null bogus &&
2298 # These modes do not allow --fixed-value at all
2299 test_must_fail git config --file=config --fixed-value --add dev.null bogus &&
2300 test_must_fail git config --file=config --fixed-value --get-urlmatch dev.null bogus &&
2301 test_must_fail git config --file=config --fixed-value --get-urlmatch dev.null bogus &&
2302 test_must_fail git config --file=config --fixed-value --rename-section dev null &&
2303 test_must_fail git config --file=config --fixed-value --remove-section dev &&
2304 test_must_fail git config --file=config --fixed-value --list &&
2305 test_must_fail git config --file=config --fixed-value --get-color dev.null &&
2306 test_must_fail git config --file=config --fixed-value --get-colorbool dev.null &&
2308 # These modes complain when --fixed-value has no value-pattern
2309 test_must_fail git config --file=config --fixed-value dev.null bogus &&
2310 test_must_fail git config --file=config --fixed-value --replace-all dev.null bogus &&
2311 test_must_fail git config --file=config --fixed-value --get dev.null &&
2312 test_must_fail git config --file=config --fixed-value --get-all dev.null &&
2313 test_must_fail git config --file=config --fixed-value --get-regexp "dev.*" &&
2314 test_must_fail git config --file=config --fixed-value --unset dev.null &&
2315 test_must_fail git config --file=config --fixed-value --unset-all dev.null
2318 test_expect_success '--fixed-value uses exact string matching' '
2319 test_when_finished rm -f config initial &&
2320 META="a+b*c?d[e]f.g" &&
2321 git config --file=initial fixed.test "$META" &&
2323 cp initial config &&
2324 git config --file=config fixed.test bogus "$META" &&
2325 git config --file=config --list >actual &&
2326 cat >expect <<-EOF &&
2327 fixed.test=$META
2328 fixed.test=bogus
2330 test_cmp expect actual &&
2332 cp initial config &&
2333 git config --file=config --fixed-value fixed.test bogus "$META" &&
2334 git config --file=config --list >actual &&
2335 cat >expect <<-\EOF &&
2336 fixed.test=bogus
2338 test_cmp expect actual &&
2340 cp initial config &&
2341 test_must_fail git config --file=config --unset fixed.test "$META" &&
2342 git config --file=config --fixed-value --unset fixed.test "$META" &&
2343 test_must_fail git config --file=config fixed.test &&
2345 cp initial config &&
2346 test_must_fail git config --file=config --unset-all fixed.test "$META" &&
2347 git config --file=config --fixed-value --unset-all fixed.test "$META" &&
2348 test_must_fail git config --file=config fixed.test &&
2350 cp initial config &&
2351 git config --file=config --replace-all fixed.test bogus "$META" &&
2352 git config --file=config --list >actual &&
2353 cat >expect <<-EOF &&
2354 fixed.test=$META
2355 fixed.test=bogus
2357 test_cmp expect actual &&
2359 git config --file=config --fixed-value --replace-all fixed.test bogus "$META" &&
2360 git config --file=config --list >actual &&
2361 cat >expect <<-EOF &&
2362 fixed.test=bogus
2363 fixed.test=bogus
2365 test_cmp expect actual
2368 test_expect_success '--get and --get-all with --fixed-value' '
2369 test_when_finished rm -f config &&
2370 META="a+b*c?d[e]f.g" &&
2371 git config --file=config fixed.test bogus &&
2372 git config --file=config --add fixed.test "$META" &&
2374 git config --file=config --get fixed.test bogus &&
2375 test_must_fail git config --file=config --get fixed.test "$META" &&
2376 git config --file=config --get --fixed-value fixed.test "$META" &&
2377 test_must_fail git config --file=config --get --fixed-value fixed.test non-existent &&
2379 git config --file=config --get-all fixed.test bogus &&
2380 test_must_fail git config --file=config --get-all fixed.test "$META" &&
2381 git config --file=config --get-all --fixed-value fixed.test "$META" &&
2382 test_must_fail git config --file=config --get-all --fixed-value fixed.test non-existent &&
2384 git config --file=config --get-regexp fixed+ bogus &&
2385 test_must_fail git config --file=config --get-regexp fixed+ "$META" &&
2386 git config --file=config --get-regexp --fixed-value fixed+ "$META" &&
2387 test_must_fail git config --file=config --get-regexp --fixed-value fixed+ non-existent
2390 test_done