t1300: demonstrate that --replace-all can "invent" newlines
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 3 Apr 2018 16:28:10 +0000 (18:28 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Apr 2018 23:30:03 +0000 (08:30 +0900)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1300-config.sh
index cbeb9bebeea67c3654c279b2c12fed4825840d8f..cef816325b6ba0c5504f8d85536a48ad7a56cbfa 100755 (executable)
@@ -1588,4 +1588,25 @@ test_expect_success '--local requires a repo' '
        test_expect_code 128 nongit git config --local foo.bar
 '
 
+test_expect_failure '--replace-all does not invent newlines' '
+       q_to_tab >.git/config <<-\EOF &&
+       [abc]key
+       QkeepSection
+       [xyz]
+       Qkey = 1
+       [abc]
+       Qkey = a
+       EOF
+       q_to_tab >expect <<-\EOF &&
+       [abc]
+       QkeepSection
+       [xyz]
+       Qkey = 1
+       [abc]
+       Qkey = b
+       EOF
+       git config --replace-all abc.key b &&
+       test_cmp .git/config expect
+'
+
 test_done