]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t1300-config.sh
Merge branch 'rs/config-comment'
[thirdparty/git.git] / t / t1300-config.sh
index f4bd69512ed98bc718d516aadf6b6ba74e7a8e8e..9b65d9eaf5f5e475b6d235b4670ec46603d4b0b3 100755 (executable)
@@ -161,14 +161,32 @@ test_expect_success 'replace with non-match (actually matching)' '
 
 cat > expect << EOF
 [section]
-       penguin = very blue
        Movie = BadPhysics
        UPPERCASE = true
-       penguin = kingpin
+       penguin = gentoo # Pygoscelis papua
+       disposition = peckish # find fish
+       foo = bar #abc
+       spsp = value # and comment
+       htsp = value    # and comment
 [Sections]
        WhatEver = Second
 EOF
 
+test_expect_success 'append comments' '
+       git config --replace-all --comment="Pygoscelis papua" section.penguin gentoo &&
+       git config --comment="find fish" section.disposition peckish &&
+       git config --comment="#abc" section.foo bar &&
+
+       git config --comment="and comment" section.spsp value &&
+       git config --comment="  # and comment" section.htsp value &&
+
+       test_cmp expect .git/config
+'
+
+test_expect_success 'Prohibited LF in comment' '
+       test_must_fail git config --comment="a${LF}b" section.k v
+'
+
 test_expect_success 'non-match result' 'test_cmp expect .git/config'
 
 test_expect_success 'find mixed-case key by canonical name' '