Commit 1f6263b82bf079b8accaecae586e1fa2da2e7736

Edward Thomson 2021-09-14T07:43:35

Merge pull request #6043 from basile-henry/config-multiline-comment-chars Fix config parsing for multiline with multiple quoted comment chars

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 = '\
+	";" \
+	";" \
+	'