| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This tests parsing a multiline string containing multiple quoted comment chars. See libgit2#6019
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).
I do, too! Thanks, @basile-henry! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #6019
The issue this PR fixes happened when parsing a git config with the following:
NB: comment characters (';' or '#') need to be quoted in order for them to be part of a string, otherwise they indicate the start of a comment. Comments are surprisingly permitted in the middle of a multiline variable.
I have added a small test that showcases the issue and then fixed it in a subsequent commit.
The fix is simply to keep the count of quotes in the multiline as an int instead of making it a bool before passing it to the strip_comments function. This seems to work just fine and all the tests now pass. I do wonder what was intended by the boolean "casting" 🤔