summaryrefslogtreecommitdiff
path: root/tests/config/write.c
diff options
context:
space:
mode:
authorSven Strickroth <email@cs-ware.de>2021-11-25 11:40:20 +0100
committerSven Strickroth <email@cs-ware.de>2021-12-06 13:28:46 +0100
commitdff05bc308f40fe327364334eaae412afca8ad61 (patch)
tree2c4509cd6016bdcdfcfb0cf6af8a16474dbbf9a7 /tests/config/write.c
parent854164a5cad8681983f0912d7255d0845ef4f7c2 (diff)
downloadlibgit2-dff05bc308f40fe327364334eaae412afca8ad61.tar.gz
Multiline config values not preserved on saving
(fixes issue #6088) Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'tests/config/write.c')
-rw-r--r--tests/config/write.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/config/write.c b/tests/config/write.c
index 4ee83833f..9d8c3fe94 100644
--- a/tests/config/write.c
+++ b/tests/config/write.c
@@ -8,6 +8,7 @@ void test_config_write__initialize(void)
cl_fixture_sandbox("config/config9");
cl_fixture_sandbox("config/config15");
cl_fixture_sandbox("config/config17");
+ cl_fixture_sandbox("config/config22");
}
void test_config_write__cleanup(void)
@@ -15,6 +16,7 @@ void test_config_write__cleanup(void)
cl_fixture_cleanup("config9");
cl_fixture_cleanup("config15");
cl_fixture_cleanup("config17");
+ cl_fixture_cleanup("config22");
}
void test_config_write__replace_value(void)
@@ -743,3 +745,20 @@ void test_config_write__preserve_case(void)
git_config_free(cfg);
}
+
+void test_config_write__write_config_file_with_multi_line_value(void)
+{
+ git_config* cfg;
+ git_buf buf = GIT_BUF_INIT;
+
+ cl_git_pass(git_config_open_ondisk(&cfg, "config22"));
+ cl_git_pass(git_config_get_string_buf(&buf, cfg, "alias.m"));
+ cl_assert_equal_s("cmd ;; ;; bar", buf.ptr);
+ cl_git_pass(git_config_set_string(cfg, "sOMe.ThInG", "foo"));
+ git_buf_dispose(&buf);
+ cl_git_pass(git_config_get_string_buf(&buf, cfg, "alias.m"));
+ cl_assert_equal_s("cmd ;; ;; bar", buf.ptr);
+ git_buf_dispose(&buf);
+
+ git_config_free(cfg);
+}