]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1303-wacky-config.sh
Merge branch 'cb/httpd-test-fix-port'
[thirdparty/git.git] / t / t1303-wacky-config.sh
CommitLineData
02e5ba4a
JK
1#!/bin/sh
2
3test_description='Test wacky input to git config'
4. ./test-lib.sh
5
6setup() {
7 (printf "[section]\n" &&
8 printf " key = foo") >.git/config
9}
10
11check() {
12 echo "$2" >expected
e0b3cc0d 13 git config --get "$1" >actual 2>&1
3af82863 14 test_cmp actual expected
02e5ba4a
JK
15}
16
17test_expect_success 'modify same key' '
18 setup &&
19 git config section.key bar &&
20 check section.key bar
21'
22
23test_expect_success 'add key in same section' '
24 setup &&
25 git config section.other bar &&
26 check section.key foo &&
27 check section.other bar
28'
29
30test_expect_success 'add key in different section' '
31 setup &&
32 git config section2.key bar &&
33 check section.key foo &&
34 check section2.key bar
35'
36
e5c349ba 37SECTION="test.q\"s\\sq'sp e.key"
0cb0e143 38test_expect_success 'make sure git config escapes section names properly' '
e5c349ba
BD
39 git config "$SECTION" bar &&
40 check "$SECTION" bar
41'
42
e0b3cc0d
TJ
43LONG_VALUE=$(printf "x%01021dx a" 7)
44test_expect_success 'do not crash on special long config line' '
45 setup &&
46 git config section.key "$LONG_VALUE" &&
e96c19c5 47 check section.key "$LONG_VALUE"
e0b3cc0d
TJ
48'
49
02e5ba4a 50test_done