]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t1300-repo-config.sh
Allow passing of configuration parameters in the command line
[thirdparty/git.git] / t / t1300-repo-config.sh
index c81ccf2e56659b41787b9da69acbb3bf9f44f984..64f05080b65c2b9506d1e34748b47ee721026aef 100755 (executable)
@@ -470,6 +470,28 @@ EOF
 
 test_expect_success "rename succeeded" "test_cmp expect .git/config"
 
+cat >> .git/config << EOF
+[branch "vier"] z = 1
+EOF
+
+test_expect_success "rename a section with a var on the same line" \
+       'git config --rename-section branch.vier branch.zwei'
+
+cat > expect << EOF
+# Hallo
+       #Bello
+[branch "zwei"]
+       x = 1
+[branch "zwei"]
+       y = 1
+[branch "drei"]
+weird
+[branch "zwei"]
+       z = 1
+EOF
+
+test_expect_success "rename succeeded" "test_cmp expect .git/config"
+
 cat >> .git/config << EOF
   [branch "zwei"] a = 1 [branch "vier"]
 EOF
@@ -672,6 +694,34 @@ test_expect_success 'set --bool-or-int' '
 
 rm .git/config
 
+cat >expect <<\EOF
+[path]
+       home = ~/
+       normal = /dev/null
+       trailingtilde = foo~
+EOF
+
+test_expect_success 'set --path' '
+       git config --path path.home "~/" &&
+       git config --path path.normal "/dev/null" &&
+       git config --path path.trailingtilde "foo~" &&
+       test_cmp expect .git/config'
+
+cat >expect <<EOF
+$HOME/
+/dev/null
+foo~
+EOF
+
+test_expect_success 'get --path' '
+       git config --get --path path.home > result &&
+       git config --get --path path.normal >> result &&
+       git config --get --path path.trailingtilde >> result &&
+       test_cmp expect result
+'
+
+rm .git/config
+
 git config quote.leading " test"
 git config quote.ending "test "
 git config quote.semicolon "test;test"
@@ -744,6 +794,11 @@ echo >>result
 
 test_expect_success '--null --get-regexp' 'cmp result expect'
 
+test_expect_success 'inner whitespace kept verbatim' '
+       git config section.val "foo       bar" &&
+       test "z$(git config section.val)" = "zfoo         bar"
+'
+
 test_expect_success SYMLINKS 'symlinked configuration' '
 
        ln -s notyet myconfig &&
@@ -769,4 +824,12 @@ test_expect_success 'check split_cmdline return' "
        test_must_fail git merge master
        "
 
+test_expect_success 'git -c "key=value" support' '
+       test "z$(git -c name=value config name)" = zvalue &&
+       test "z$(git -c core.name=value config core.name)" = zvalue &&
+       test "z$(git -c CamelCase=value config camelcase)" = zvalue &&
+       test "z$(git -c flag config --bool flag)" = ztrue &&
+       test_must_fail git -c core.name=value config name
+'
+
 test_done