Merge pull request #6043 from basile-henry/config-multiline-comment-chars Fix config parsing for multiline with multiple quoted comment chars
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
diff --git a/src/config_parse.c b/src/config_parse.c
index a2d779b..9f95e67 100644
--- a/src/config_parse.c
+++ b/src/config_parse.c
@@ -349,7 +349,7 @@ static int parse_multiline_variable(git_config_parser *reader, git_buf *value, i
}
/* If it was just a comment, pretend it didn't exist */
- quote_count = strip_comments(line, !!in_quotes);
+ quote_count = strip_comments(line, in_quotes);
if (line[0] == '\0')
goto next;
diff --git a/tests/config/read.c b/tests/config/read.c
index badf511..8d1bb8b 100644
--- a/tests/config/read.c
+++ b/tests/config/read.c
@@ -213,6 +213,13 @@ void test_config_read__symbol_headers(void)
git_config_free(cfg);
}
+void test_config_read__multiline_multiple_quoted_comment_chars(void)
+{
+ git_config *cfg;
+ cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config21")));
+ git_config_free(cfg);
+}
+
void test_config_read__header_in_last_line(void)
{
git_config *cfg;
diff --git a/tests/resources/config/config21 b/tests/resources/config/config21
new file mode 100644
index 0000000..aa5eb41
--- /dev/null
+++ b/tests/resources/config/config21
@@ -0,0 +1,5 @@
+[alias]
+ m = '\
+ ";" \
+ ";" \
+ '