t1300: demonstrate that --replace-all can "invent" newlines
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Apr 3, 2018 at 18:28 UTC
e9313952bf85bcc8b602f582b2e71660d670f97b
1 file changed
+21
t/t1300-config.sh
+21
@@ -1588,4 +1588,25 @@ test_expect_success '--local requires a repo' '
1588
test_expect_code 128 nongit git config --local foo.bar
1589
'
1590
1591
+test_expect_failure '--replace-all does not invent newlines' '
1592
+ q_to_tab >.git/config <<-\EOF &&
1593
+ [abc]key
1594
+ QkeepSection
1595
+ [xyz]
1596
+ Qkey = 1
1597
+ [abc]
1598
+ Qkey = a
1599
+ EOF
1600
+ q_to_tab >expect <<-\EOF &&
1601
+ [abc]
1602
+ QkeepSection
1603
+ [xyz]
1604
+ Qkey = 1
1605
+ [abc]
1606
+ Qkey = b
1607
+ EOF
1608
+ git config --replace-all abc.key b &&
1609
+ test_cmp .git/config expect
1610
+'
1611
+
1612
test_done