Merge branch 'maint-1.5.1' into maint
[gitweb.git] / t / t1300-repo-config.sh
index 49b5666b33283feaf8ea2b7c09faeab8016c746d..3f3fd2d7f7cc148948a20e47cccd06751b9a2241 100755 (executable)
@@ -368,12 +368,12 @@ cat > expect << EOF
 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'
@@ -389,7 +389,42 @@ cat > expect << EOF
 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 '
 
@@ -401,6 +436,40 @@ 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"