Commit 574c590f3095535e55e8f99b7f571ede28c8c211

Basile Henry 2021-09-09T21:53:45

Fix multiline strip_comments logic The strip_comments function uses the count of quotes to know if a comment char (';' or '#') is the start of a comment or part of the multiline as a string. Unfortunately converting the count of quotes from previous lines to a boolean meant that it would only work as expected in some cases (0 quotes or an odd number of quotes).

1
2
3
4
5
6
7
8
9
10
11
12
13
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;