Skip to content

Commit 1f6263b

Browse files
authored
Merge pull request libgit2#6043 from basile-henry/config-multiline-comment-chars
Fix config parsing for multiline with multiple quoted comment chars
2 parents baf001e + 574c590 commit 1f6263b

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/config_parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int parse_multiline_variable(git_config_parser *reader, git_buf *value, i
349349
}
350350

351351
/* If it was just a comment, pretend it didn't exist */
352-
quote_count = strip_comments(line, !!in_quotes);
352+
quote_count = strip_comments(line, in_quotes);
353353
if (line[0] == '\0')
354354
goto next;
355355

tests/config/read.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ void test_config_read__symbol_headers(void)
213213
git_config_free(cfg);
214214
}
215215

216+
void test_config_read__multiline_multiple_quoted_comment_chars(void)
217+
{
218+
git_config *cfg;
219+
cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config21")));
220+
git_config_free(cfg);
221+
}
222+
216223
void test_config_read__header_in_last_line(void)
217224
{
218225
git_config *cfg;

tests/resources/config/config21

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[alias]
2+
m = '\
3+
";" \
4+
";" \
5+
'

0 commit comments

Comments
 (0)