3 test_description='Test wacky input to git config'
7 (printf "[section]\n" &&
8 printf " key = foo") >.git/config
13 git config --get "$1" >actual 2>&1
14 test_cmp actual expected
17 test_expect_success 'modify same key' '
19 git config section.key bar &&
23 test_expect_success 'add key in same section' '
25 git config section.other bar &&
26 check section.key foo &&
27 check section.other bar
30 test_expect_success 'add key in different section' '
32 git config section2.key bar &&
33 check section.key foo &&
34 check section2.key bar
37 SECTION="test.q\"s\\sq'sp e.key"
38 test_expect_success 'make sure git config escapes section names properly' '
39 git config "$SECTION" bar &&
43 LONG_VALUE=$(printf "x%01021dx a" 7)
44 test_expect_success 'do not crash on special long config line' '
46 git config section.key "$LONG_VALUE" &&
47 check section.key "fatal: bad config file line 2 in .git/config"