diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-14 07:43:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 07:43:35 -0400 |
commit | 1f6263b82bf079b8accaecae586e1fa2da2e7736 (patch) | |
tree | 1d9a0572b409d7a3b563f12e2aba86e7d9036047 | |
parent | baf001ed0653d5deb666d1cef97f086e67e728bf (diff) | |
parent | 574c590f3095535e55e8f99b7f571ede28c8c211 (diff) | |
download | libgit2-1f6263b82bf079b8accaecae586e1fa2da2e7736.tar.gz |
Merge pull request #6043 from basile-henry/config-multiline-comment-chars
Fix config parsing for multiline with multiple quoted comment chars
-rw-r--r-- | src/config_parse.c | 2 | ||||
-rw-r--r-- | tests/config/read.c | 7 | ||||
-rw-r--r-- | tests/resources/config/config21 | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/src/config_parse.c b/src/config_parse.c index a2d779bfa..9f95e67d7 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 badf5118e..8d1bb8b0a 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 000000000..aa5eb4115 --- /dev/null +++ b/tests/resources/config/config21 @@ -0,0 +1,5 @@ +[alias] + m = '\ + ";" \ + ";" \ + ' |