]>
Commit | Line | Data |
---|---|---|
942c1f53 JS |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Johannes Schindelin | |
4 | # | |
5 | ||
5be60078 | 6 | test_description='Test git config in different settings' |
942c1f53 JS |
7 | |
8 | . ./test-lib.sh | |
9 | ||
10 | test -f .git/config && rm .git/config | |
11 | ||
5be60078 | 12 | git config core.penguin "little blue" |
942c1f53 JS |
13 | |
14 | cat > expect << EOF | |
942c1f53 JS |
15 | [core] |
16 | penguin = little blue | |
17 | EOF | |
18 | ||
19 | test_expect_success 'initial' 'cmp .git/config expect' | |
20 | ||
5be60078 | 21 | git config Core.Movie BadPhysics |
942c1f53 JS |
22 | |
23 | cat > expect << EOF | |
942c1f53 JS |
24 | [core] |
25 | penguin = little blue | |
26 | Movie = BadPhysics | |
27 | EOF | |
28 | ||
29 | test_expect_success 'mixed case' 'cmp .git/config expect' | |
30 | ||
5be60078 | 31 | git config Cores.WhatEver Second |
942c1f53 JS |
32 | |
33 | cat > expect << EOF | |
942c1f53 JS |
34 | [core] |
35 | penguin = little blue | |
36 | Movie = BadPhysics | |
37 | [Cores] | |
38 | WhatEver = Second | |
39 | EOF | |
40 | ||
41 | test_expect_success 'similar section' 'cmp .git/config expect' | |
42 | ||
5be60078 | 43 | git config CORE.UPPERCASE true |
942c1f53 JS |
44 | |
45 | cat > expect << EOF | |
942c1f53 JS |
46 | [core] |
47 | penguin = little blue | |
48 | Movie = BadPhysics | |
49 | UPPERCASE = true | |
50 | [Cores] | |
51 | WhatEver = Second | |
52 | EOF | |
53 | ||
54 | test_expect_success 'similar section' 'cmp .git/config expect' | |
55 | ||
f98d863d | 56 | test_expect_success 'replace with non-match' \ |
5be60078 | 57 | 'git config core.penguin kingpin !blue' |
f98d863d JS |
58 | |
59 | test_expect_success 'replace with non-match (actually matching)' \ | |
5be60078 | 60 | 'git config core.penguin "very blue" !kingpin' |
f98d863d JS |
61 | |
62 | cat > expect << EOF | |
f98d863d JS |
63 | [core] |
64 | penguin = very blue | |
65 | Movie = BadPhysics | |
66 | UPPERCASE = true | |
67 | penguin = kingpin | |
68 | [Cores] | |
69 | WhatEver = Second | |
70 | EOF | |
71 | ||
72 | test_expect_success 'non-match result' 'cmp .git/config expect' | |
73 | ||
7a31cc0f FL |
74 | cat > .git/config <<\EOF |
75 | [alpha] | |
76 | bar = foo | |
77 | [beta] | |
78 | baz = multiple \ | |
79 | lines | |
80 | EOF | |
81 | ||
82 | test_expect_success 'unset with cont. lines' \ | |
83 | 'git config --unset beta.baz' | |
84 | ||
85 | cat > expect <<\EOF | |
86 | [alpha] | |
87 | bar = foo | |
88 | [beta] | |
89 | EOF | |
90 | ||
91 | test_expect_success 'unset with cont. lines is correct' 'cmp .git/config expect' | |
92 | ||
942c1f53 JS |
93 | cat > .git/config << EOF |
94 | [beta] ; silly comment # another comment | |
95 | noIndent= sillyValue ; 'nother silly comment | |
96 | ||
97 | # empty line | |
98 | ; comment | |
99 | haha ="beta" # last silly comment | |
4ddba79d JS |
100 | haha = hello |
101 | haha = bello | |
942c1f53 JS |
102 | [nextSection] noNewline = ouch |
103 | EOF | |
104 | ||
4ddba79d JS |
105 | cp .git/config .git/config2 |
106 | ||
107 | test_expect_success 'multiple unset' \ | |
5be60078 | 108 | 'git config --unset-all beta.haha' |
4ddba79d JS |
109 | |
110 | cat > expect << EOF | |
111 | [beta] ; silly comment # another comment | |
112 | noIndent= sillyValue ; 'nother silly comment | |
113 | ||
114 | # empty line | |
115 | ; comment | |
116 | [nextSection] noNewline = ouch | |
117 | EOF | |
118 | ||
119 | test_expect_success 'multiple unset is correct' 'cmp .git/config expect' | |
120 | ||
121 | mv .git/config2 .git/config | |
122 | ||
123 | test_expect_success '--replace-all' \ | |
5be60078 | 124 | 'git config --replace-all beta.haha gamma' |
4ddba79d JS |
125 | |
126 | cat > expect << EOF | |
127 | [beta] ; silly comment # another comment | |
128 | noIndent= sillyValue ; 'nother silly comment | |
129 | ||
130 | # empty line | |
131 | ; comment | |
132 | haha = gamma | |
133 | [nextSection] noNewline = ouch | |
134 | EOF | |
135 | ||
136 | test_expect_success 'all replaced' 'cmp .git/config expect' | |
137 | ||
5be60078 | 138 | git config beta.haha alpha |
942c1f53 JS |
139 | |
140 | cat > expect << EOF | |
141 | [beta] ; silly comment # another comment | |
142 | noIndent= sillyValue ; 'nother silly comment | |
143 | ||
144 | # empty line | |
145 | ; comment | |
146 | haha = alpha | |
147 | [nextSection] noNewline = ouch | |
148 | EOF | |
149 | ||
150 | test_expect_success 'really mean test' 'cmp .git/config expect' | |
151 | ||
5be60078 | 152 | git config nextsection.nonewline wow |
942c1f53 JS |
153 | |
154 | cat > expect << EOF | |
155 | [beta] ; silly comment # another comment | |
156 | noIndent= sillyValue ; 'nother silly comment | |
157 | ||
158 | # empty line | |
159 | ; comment | |
160 | haha = alpha | |
161 | [nextSection] | |
162 | nonewline = wow | |
163 | EOF | |
164 | ||
165 | test_expect_success 'really really mean test' 'cmp .git/config expect' | |
166 | ||
5be60078 JH |
167 | test_expect_success 'get value' 'test alpha = $(git config beta.haha)' |
168 | git config --unset beta.haha | |
942c1f53 JS |
169 | |
170 | cat > expect << EOF | |
171 | [beta] ; silly comment # another comment | |
172 | noIndent= sillyValue ; 'nother silly comment | |
173 | ||
174 | # empty line | |
175 | ; comment | |
176 | [nextSection] | |
177 | nonewline = wow | |
178 | EOF | |
179 | ||
180 | test_expect_success 'unset' 'cmp .git/config expect' | |
181 | ||
5be60078 | 182 | git config nextsection.NoNewLine "wow2 for me" "for me$" |
942c1f53 JS |
183 | |
184 | cat > expect << EOF | |
185 | [beta] ; silly comment # another comment | |
186 | noIndent= sillyValue ; 'nother silly comment | |
187 | ||
188 | # empty line | |
189 | ; comment | |
190 | [nextSection] | |
191 | nonewline = wow | |
192 | NoNewLine = wow2 for me | |
193 | EOF | |
194 | ||
195 | test_expect_success 'multivar' 'cmp .git/config expect' | |
196 | ||
f98d863d | 197 | test_expect_success 'non-match' \ |
5be60078 | 198 | 'git config --get nextsection.nonewline !for' |
f98d863d JS |
199 | |
200 | test_expect_success 'non-match value' \ | |
5be60078 | 201 | 'test wow = $(git config --get nextsection.nonewline !for)' |
f98d863d | 202 | |
41ac414e JH |
203 | test_expect_success 'ambiguous get' ' |
204 | ! git config --get nextsection.nonewline | |
205 | ' | |
4ddba79d JS |
206 | |
207 | test_expect_success 'get multivar' \ | |
5be60078 | 208 | 'git config --get-all nextsection.nonewline' |
4ddba79d | 209 | |
5be60078 | 210 | git config nextsection.nonewline "wow3" "wow$" |
942c1f53 JS |
211 | |
212 | cat > expect << EOF | |
213 | [beta] ; silly comment # another comment | |
214 | noIndent= sillyValue ; 'nother silly comment | |
215 | ||
216 | # empty line | |
217 | ; comment | |
218 | [nextSection] | |
219 | nonewline = wow3 | |
220 | NoNewLine = wow2 for me | |
221 | EOF | |
222 | ||
223 | test_expect_success 'multivar replace' 'cmp .git/config expect' | |
224 | ||
41ac414e JH |
225 | test_expect_success 'ambiguous value' ' |
226 | ! git config nextsection.nonewline | |
227 | ' | |
4ddba79d | 228 | |
41ac414e JH |
229 | test_expect_success 'ambiguous unset' ' |
230 | ! git config --unset nextsection.nonewline | |
231 | ' | |
942c1f53 | 232 | |
41ac414e JH |
233 | test_expect_success 'invalid unset' ' |
234 | ! git config --unset somesection.nonewline | |
235 | ' | |
942c1f53 | 236 | |
5be60078 | 237 | git config --unset nextsection.nonewline "wow3$" |
942c1f53 JS |
238 | |
239 | cat > expect << EOF | |
240 | [beta] ; silly comment # another comment | |
241 | noIndent= sillyValue ; 'nother silly comment | |
242 | ||
243 | # empty line | |
244 | ; comment | |
245 | [nextSection] | |
246 | NoNewLine = wow2 for me | |
247 | EOF | |
248 | ||
249 | test_expect_success 'multivar unset' 'cmp .git/config expect' | |
250 | ||
41ac414e | 251 | test_expect_success 'invalid key' '! git config inval.2key blabla' |
942c1f53 | 252 | |
5be60078 | 253 | test_expect_success 'correct key' 'git config 123456.a123 987' |
942c1f53 | 254 | |
b17e659d | 255 | test_expect_success 'hierarchical section' \ |
5be60078 | 256 | 'git config Version.1.2.3eX.Alpha beta' |
b17e659d JS |
257 | |
258 | cat > expect << EOF | |
259 | [beta] ; silly comment # another comment | |
260 | noIndent= sillyValue ; 'nother silly comment | |
261 | ||
262 | # empty line | |
263 | ; comment | |
264 | [nextSection] | |
265 | NoNewLine = wow2 for me | |
266 | [123456] | |
267 | a123 = 987 | |
d14f7764 LT |
268 | [Version "1.2.3eX"] |
269 | Alpha = beta | |
b17e659d JS |
270 | EOF |
271 | ||
272 | test_expect_success 'hierarchical section value' 'cmp .git/config expect' | |
273 | ||
2fa9a0fb JS |
274 | cat > expect << EOF |
275 | beta.noindent=sillyValue | |
276 | nextsection.nonewline=wow2 for me | |
277 | 123456.a123=987 | |
d55aaefa | 278 | version.1.2.3eX.alpha=beta |
2fa9a0fb JS |
279 | EOF |
280 | ||
281 | test_expect_success 'working --list' \ | |
5be60078 | 282 | 'git config --list > output && cmp output expect' |
2fa9a0fb JS |
283 | |
284 | cat > expect << EOF | |
285 | beta.noindent sillyValue | |
286 | nextsection.nonewline wow2 for me | |
287 | EOF | |
288 | ||
289 | test_expect_success '--get-regexp' \ | |
5be60078 | 290 | 'git config --get-regexp in > output && cmp output expect' |
2fa9a0fb | 291 | |
5be60078 | 292 | git config --add nextsection.nonewline "wow4 for you" |
89c4afe0 BG |
293 | |
294 | cat > expect << EOF | |
295 | wow2 for me | |
296 | wow4 for you | |
297 | EOF | |
298 | ||
299 | test_expect_success '--add' \ | |
5be60078 | 300 | 'git config --get-all nextsection.nonewline > output && cmp output expect' |
89c4afe0 | 301 | |
f067a137 JF |
302 | cat > .git/config << EOF |
303 | [novalue] | |
304 | variable | |
09bc098c CC |
305 | [emptyvalue] |
306 | variable = | |
f067a137 JF |
307 | EOF |
308 | ||
309 | test_expect_success 'get variable with no value' \ | |
5be60078 | 310 | 'git config --get novalue.variable ^$' |
f067a137 | 311 | |
09bc098c CC |
312 | test_expect_success 'get variable with empty value' \ |
313 | 'git config --get emptyvalue.variable ^$' | |
314 | ||
b69ba460 FL |
315 | echo novalue.variable > expect |
316 | ||
317 | test_expect_success 'get-regexp variable with no value' \ | |
5be60078 | 318 | 'git config --get-regexp novalue > output && |
b69ba460 FL |
319 | cmp output expect' |
320 | ||
09bc098c CC |
321 | echo 'emptyvalue.variable ' > expect |
322 | ||
323 | test_expect_success 'get-regexp variable with empty value' \ | |
324 | 'git config --get-regexp emptyvalue > output && | |
325 | cmp output expect' | |
326 | ||
327 | echo true > expect | |
328 | ||
329 | test_expect_success 'get bool variable with no value' \ | |
330 | 'git config --bool novalue.variable > output && | |
331 | cmp output expect' | |
332 | ||
333 | echo false > expect | |
334 | ||
335 | test_expect_success 'get bool variable with empty value' \ | |
336 | 'git config --bool emptyvalue.variable > output && | |
337 | cmp output expect' | |
338 | ||
5be60078 | 339 | git config > output 2>&1 |
2fa9a0fb JS |
340 | |
341 | test_expect_success 'no arguments, but no crash' \ | |
342 | "test $? = 129 && grep usage output" | |
343 | ||
bd886fd3 SE |
344 | cat > .git/config << EOF |
345 | [a.b] | |
346 | c = d | |
347 | EOF | |
348 | ||
5be60078 | 349 | git config a.x y |
bd886fd3 SE |
350 | |
351 | cat > expect << EOF | |
352 | [a.b] | |
353 | c = d | |
354 | [a] | |
355 | x = y | |
356 | EOF | |
357 | ||
358 | test_expect_success 'new section is partial match of another' 'cmp .git/config expect' | |
359 | ||
5be60078 JH |
360 | git config b.x y |
361 | git config a.b c | |
bd886fd3 SE |
362 | |
363 | cat > expect << EOF | |
364 | [a.b] | |
365 | c = d | |
366 | [a] | |
367 | x = y | |
368 | b = c | |
369 | [b] | |
370 | x = y | |
371 | EOF | |
372 | ||
373 | test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect' | |
374 | ||
773a69fb AR |
375 | test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \ |
376 | 'git config --file non-existing-config -l; test $? != 0' | |
377 | ||
9c3796fc JS |
378 | cat > other-config << EOF |
379 | [ein] | |
380 | bahn = strasse | |
381 | EOF | |
382 | ||
383 | cat > expect << EOF | |
384 | ein.bahn=strasse | |
385 | EOF | |
386 | ||
5be60078 | 387 | GIT_CONFIG=other-config git config -l > output |
9c3796fc JS |
388 | |
389 | test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' | |
390 | ||
773a69fb AR |
391 | test_expect_success 'alternative GIT_CONFIG (--file)' \ |
392 | 'git config --file other-config -l > output && cmp output expect' | |
393 | ||
5be60078 | 394 | GIT_CONFIG=other-config git config anwohner.park ausweis |
9c3796fc JS |
395 | |
396 | cat > expect << EOF | |
397 | [ein] | |
398 | bahn = strasse | |
399 | [anwohner] | |
400 | park = ausweis | |
401 | EOF | |
402 | ||
403 | test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect' | |
404 | ||
0667fcfb JS |
405 | cat > .git/config << EOF |
406 | # Hallo | |
407 | #Bello | |
408 | [branch "eins"] | |
409 | x = 1 | |
410 | [branch.eins] | |
411 | y = 1 | |
412 | [branch "1 234 blabl/a"] | |
413 | weird | |
414 | EOF | |
415 | ||
416 | test_expect_success "rename section" \ | |
5be60078 | 417 | "git config --rename-section branch.eins branch.zwei" |
0667fcfb JS |
418 | |
419 | cat > expect << EOF | |
420 | # Hallo | |
421 | #Bello | |
422 | [branch "zwei"] | |
423 | x = 1 | |
424 | [branch "zwei"] | |
425 | y = 1 | |
426 | [branch "1 234 blabl/a"] | |
427 | weird | |
428 | EOF | |
429 | ||
5bd74506 | 430 | test_expect_success "rename succeeded" "git diff expect .git/config" |
0667fcfb | 431 | |
41ac414e JH |
432 | test_expect_success "rename non-existing section" ' |
433 | ! git config --rename-section branch."world domination" branch.drei | |
434 | ' | |
0667fcfb | 435 | |
5bd74506 | 436 | test_expect_success "rename succeeded" "git diff expect .git/config" |
0667fcfb JS |
437 | |
438 | test_expect_success "rename another section" \ | |
5be60078 | 439 | 'git config --rename-section branch."1 234 blabl/a" branch.drei' |
0667fcfb JS |
440 | |
441 | cat > expect << EOF | |
442 | # Hallo | |
443 | #Bello | |
444 | [branch "zwei"] | |
445 | x = 1 | |
446 | [branch "zwei"] | |
447 | y = 1 | |
448 | [branch "drei"] | |
449 | weird | |
450 | EOF | |
451 | ||
5bd74506 | 452 | test_expect_success "rename succeeded" "git diff expect .git/config" |
0667fcfb | 453 | |
118f8b24 PB |
454 | cat >> .git/config << EOF |
455 | [branch "zwei"] a = 1 [branch "vier"] | |
456 | EOF | |
457 | ||
458 | test_expect_success "remove section" "git config --remove-section branch.zwei" | |
459 | ||
460 | cat > expect << EOF | |
461 | # Hallo | |
462 | #Bello | |
463 | [branch "drei"] | |
464 | weird | |
465 | EOF | |
466 | ||
467 | test_expect_success "section was removed properly" \ | |
cf6981d4 | 468 | "git diff -u expect .git/config" |
118f8b24 | 469 | |
b18a2be3 SP |
470 | rm .git/config |
471 | ||
472 | cat > expect << EOF | |
473 | [gitcvs] | |
474 | enabled = true | |
475 | dbname = %Ggitcvs2.%a.%m.sqlite | |
476 | [gitcvs "ext"] | |
477 | dbname = %Ggitcvs1.%a.%m.sqlite | |
478 | EOF | |
479 | ||
480 | test_expect_success 'section ending' ' | |
481 | ||
5be60078 JH |
482 | git config gitcvs.enabled true && |
483 | git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && | |
484 | git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && | |
b18a2be3 SP |
485 | cmp .git/config expect |
486 | ||
487 | ' | |
488 | ||
d77a64d3 SP |
489 | test_expect_success numbers ' |
490 | ||
5be60078 JH |
491 | git config kilo.gram 1k && |
492 | git config mega.ton 1m && | |
493 | k=$(git config --int --get kilo.gram) && | |
d77a64d3 | 494 | test z1024 = "z$k" && |
5be60078 | 495 | m=$(git config --int --get mega.ton) && |
d77a64d3 SP |
496 | test z1048576 = "z$m" |
497 | ' | |
498 | ||
c8deb5a1 SP |
499 | cat > expect <<EOF |
500 | fatal: bad config value for 'aninvalid.unit' in .git/config | |
501 | EOF | |
502 | ||
503 | test_expect_success 'invalid unit' ' | |
504 | ||
505 | git config aninvalid.unit "1auto" && | |
506 | s=$(git config aninvalid.unit) && | |
507 | test "z1auto" = "z$s" && | |
508 | if git config --int --get aninvalid.unit 2>actual | |
509 | then | |
510 | echo config should have failed | |
511 | false | |
512 | fi && | |
513 | cmp actual expect | |
514 | ' | |
515 | ||
cab333cb FL |
516 | cat > expect << EOF |
517 | true | |
518 | false | |
519 | true | |
520 | false | |
521 | true | |
522 | false | |
523 | true | |
524 | false | |
525 | EOF | |
526 | ||
527 | test_expect_success bool ' | |
528 | ||
5be60078 JH |
529 | git config bool.true1 01 && |
530 | git config bool.true2 -1 && | |
531 | git config bool.true3 YeS && | |
532 | git config bool.true4 true && | |
533 | git config bool.false1 000 && | |
534 | git config bool.false2 "" && | |
535 | git config bool.false3 nO && | |
536 | git config bool.false4 FALSE && | |
cab333cb FL |
537 | rm -f result && |
538 | for i in 1 2 3 4 | |
539 | do | |
5be60078 JH |
540 | git config --bool --get bool.true$i >>result |
541 | git config --bool --get bool.false$i >>result | |
cab333cb FL |
542 | done && |
543 | cmp expect result' | |
544 | ||
41ac414e | 545 | test_expect_success 'invalid bool (--get)' ' |
cab333cb | 546 | |
5be60078 | 547 | git config bool.nobool foobar && |
41ac414e | 548 | ! git config --bool --get bool.nobool' |
cab333cb | 549 | |
41ac414e | 550 | test_expect_success 'invalid bool (set)' ' |
db1696b8 | 551 | |
41ac414e | 552 | ! git config --bool bool.nobool foobar' |
db1696b8 FL |
553 | |
554 | rm .git/config | |
555 | ||
556 | cat > expect <<\EOF | |
557 | [bool] | |
558 | true1 = true | |
559 | true2 = true | |
560 | true3 = true | |
561 | true4 = true | |
562 | false1 = false | |
563 | false2 = false | |
564 | false3 = false | |
565 | false4 = false | |
566 | EOF | |
567 | ||
568 | test_expect_success 'set --bool' ' | |
569 | ||
5be60078 JH |
570 | git config --bool bool.true1 01 && |
571 | git config --bool bool.true2 -1 && | |
572 | git config --bool bool.true3 YeS && | |
573 | git config --bool bool.true4 true && | |
574 | git config --bool bool.false1 000 && | |
575 | git config --bool bool.false2 "" && | |
576 | git config --bool bool.false3 nO && | |
577 | git config --bool bool.false4 FALSE && | |
db1696b8 FL |
578 | cmp expect .git/config' |
579 | ||
580 | rm .git/config | |
581 | ||
582 | cat > expect <<\EOF | |
583 | [int] | |
584 | val1 = 1 | |
585 | val2 = -1 | |
586 | val3 = 5242880 | |
587 | EOF | |
588 | ||
589 | test_expect_success 'set --int' ' | |
590 | ||
5be60078 JH |
591 | git config --int int.val1 01 && |
592 | git config --int int.val2 -1 && | |
593 | git config --int int.val3 5m && | |
db1696b8 FL |
594 | cmp expect .git/config' |
595 | ||
cdd4fb15 BG |
596 | rm .git/config |
597 | ||
5be60078 JH |
598 | git config quote.leading " test" |
599 | git config quote.ending "test " | |
600 | git config quote.semicolon "test;test" | |
601 | git config quote.hash "test#test" | |
cdd4fb15 BG |
602 | |
603 | cat > expect << EOF | |
604 | [quote] | |
605 | leading = " test" | |
606 | ending = "test " | |
607 | semicolon = "test;test" | |
608 | hash = "test#test" | |
609 | EOF | |
610 | ||
611 | test_expect_success 'quoting' 'cmp .git/config expect' | |
612 | ||
41ac414e JH |
613 | test_expect_success 'key with newline' ' |
614 | ! git config "key.with | |
615 | newline" 123' | |
6f71686e | 616 | |
e0d10e1c | 617 | test_expect_success 'value with newline' 'git config key.sub value.with\\\ |
6f71686e JS |
618 | newline' |
619 | ||
83cd10a0 JN |
620 | cat > .git/config <<\EOF |
621 | [section] | |
622 | ; comment \ | |
623 | continued = cont\ | |
624 | inued | |
625 | noncont = not continued ; \ | |
626 | quotecont = "cont;\ | |
627 | inued" | |
628 | EOF | |
629 | ||
630 | cat > expect <<\EOF | |
631 | section.continued=continued | |
632 | section.noncont=not continued | |
633 | section.quotecont=cont;inued | |
634 | EOF | |
635 | ||
e0d10e1c | 636 | git config --list > result |
83cd10a0 JN |
637 | |
638 | test_expect_success 'value continued on next line' 'cmp result expect' | |
639 | ||
2275d502 FL |
640 | cat > .git/config <<\EOF |
641 | [section "sub=section"] | |
642 | val1 = foo=bar | |
643 | val2 = foo\nbar | |
644 | val3 = \n\n | |
645 | val4 = | |
646 | val5 | |
647 | EOF | |
648 | ||
649 | cat > expect <<\EOF | |
2b9a5020 AR |
650 | section.sub=section.val1 |
651 | foo=barQsection.sub=section.val2 | |
652 | foo | |
653 | barQsection.sub=section.val3 | |
2275d502 FL |
654 | |
655 | ||
2b9a5020 AR |
656 | Qsection.sub=section.val4 |
657 | Qsection.sub=section.val5Q | |
2275d502 FL |
658 | EOF |
659 | ||
3175b0cf | 660 | git config --null --list | tr '\000' 'Q' > result |
2b9a5020 | 661 | echo >>result |
2275d502 FL |
662 | |
663 | test_expect_success '--null --list' 'cmp result expect' | |
664 | ||
3175b0cf | 665 | git config --null --get-regexp 'val[0-9]' | tr '\000' 'Q' > result |
2b9a5020 | 666 | echo >>result |
2275d502 FL |
667 | |
668 | test_expect_success '--null --get-regexp' 'cmp result expect' | |
669 | ||
65a5a21d JH |
670 | test_expect_success 'symlinked configuration' ' |
671 | ||
672 | ln -s notyet myconfig && | |
673 | GIT_CONFIG=myconfig git config test.frotz nitfol && | |
674 | test -h myconfig && | |
675 | test -f notyet && | |
676 | test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol && | |
677 | GIT_CONFIG=myconfig git config test.xyzzy rezrov && | |
678 | test -h myconfig && | |
679 | test -f notyet && | |
680 | test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol && | |
681 | test "z$(GIT_CONFIG=notyet git config test.xyzzy)" = zrezrov | |
682 | ||
683 | ' | |
684 | ||
942c1f53 | 685 | test_done |