Skip to content

Commit 5340ca7

Browse files
committed
config_parse: add comment to clarify logic getting next character
Upon each line, the configuration parser tries to get either the first non-whitespace character or the first whitespace character, in case there is no non-whitespace character. The logic handling this looks rather odd and doesn't immediately convey this meaning, so add a comment to clarify what happens.
1 parent f722594 commit 5340ca7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/config_parse.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ int git_config_parse(
475475
size_t line_len = parser->ctx.line_len;
476476
char c;
477477

478+
/*
479+
* Get either first non-whitespace character or, if that does
480+
* not exist, the first whitespace character. This is required
481+
* to preserve whitespaces when writing back the file.
482+
*/
478483
if (git_parse_peek(&c, ctx, GIT_PARSE_PEEK_SKIP_WHITESPACE) < 0 &&
479484
git_parse_peek(&c, ctx, 0) < 0)
480485
continue;

0 commit comments

Comments
 (0)