test_expect_success 'get variable with no value' \
'git-config --get novalue.variable ^$'
+echo novalue.variable > expect
+
+test_expect_success 'get-regexp variable with no value' \
+ 'git-config --get-regexp novalue > output &&
+ cmp output expect'
+
git-config > output 2>&1
test_expect_success 'no arguments, but no crash' \
weird
EOF
-test_expect_success "rename succeeded" "diff -u expect .git/config"
+test_expect_success "rename succeeded" "git diff expect .git/config"
test_expect_failure "rename non-existing section" \
'git-config --rename-section branch."world domination" branch.drei'
-test_expect_success "rename succeeded" "diff -u expect .git/config"
+test_expect_success "rename succeeded" "git diff expect .git/config"
test_expect_success "rename another section" \
'git-config --rename-section branch."1 234 blabl/a" branch.drei'
weird
EOF
-test_expect_success "rename succeeded" "diff -u expect .git/config"
+test_expect_success "rename succeeded" "git diff expect .git/config"
+
+cat >> .git/config << EOF
+ [branch "zwei"] a = 1 [branch "vier"]
+EOF
+
+test_expect_success "remove section" "git config --remove-section branch.zwei"
+
+cat > expect << EOF
+# Hallo
+ #Bello
+[branch "drei"]
+weird
+EOF
+
+test_expect_success "section was removed properly" \
+ "git diff -u expect .git/config"
+
+rm .git/config
+
+cat > expect << EOF
+[gitcvs]
+ enabled = true
+ dbname = %Ggitcvs2.%a.%m.sqlite
+[gitcvs "ext"]
+ dbname = %Ggitcvs1.%a.%m.sqlite
+EOF
+
+test_expect_success 'section ending' '
+
+ git-config gitcvs.enabled true &&
+ git-config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
+ git-config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
+ cmp .git/config expect
+
+'
test_expect_success numbers '
test z1048576 = "z$m"
'
+cat > expect << EOF
+true
+false
+true
+false
+true
+false
+true
+false
+EOF
+
+test_expect_success bool '
+
+ git-config bool.true1 01 &&
+ git-config bool.true2 -1 &&
+ git-config bool.true3 YeS &&
+ git-config bool.true4 true &&
+ git-config bool.false1 000 &&
+ git-config bool.false2 "" &&
+ git-config bool.false3 nO &&
+ git-config bool.false4 FALSE &&
+ rm -f result &&
+ for i in 1 2 3 4
+ do
+ git-config --bool --get bool.true$i >>result
+ git-config --bool --get bool.false$i >>result
+ done &&
+ cmp expect result'
+
+test_expect_failure 'invalid bool' '
+
+ git-config bool.nobool foobar &&
+ git-config --bool --get bool.nobool'
+
rm .git/config
git-config quote.leading " test"
test_expect_success 'value continued on next line' 'cmp result expect'
-test_done
+cat > .git/config <<\EOF
+[section "sub=section"]
+ val1 = foo=bar
+ val2 = foo\nbar
+ val3 = \n\n
+ val4 =
+ val5
+EOF
+cat > expect <<\EOF
+section.sub=section.val1
+foo=barQsection.sub=section.val2
+foo
+barQsection.sub=section.val3
+
+
+Qsection.sub=section.val4
+Qsection.sub=section.val5Q
+EOF
+
+git config --null --list | tr '[\000]' 'Q' > result
+echo >>result
+
+test_expect_success '--null --list' 'cmp result expect'
+
+git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result
+echo >>result
+
+test_expect_success '--null --get-regexp' 'cmp result expect'
+
+test_done