Re: [PATCH v6 01/16] Git.pm: add subroutines for commenting lines
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 10, 2016, 22:09 UTC
- Message-ID
- <xmqqy3zno2qv.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1481364496.1993.14.camel@sapo.pt>
Vasco Almeida <vascomalmeida@sapo.pt> writes:
> I wonder why this is important when Git errors out when > core.commentChar is set to more than 1 characters or 0 characters.
I think it should be consistent with the way core.commentchar is treated in the rest of the system, namely this bit from config.c:
if (!strcmp(var, "core.commentchar")) {
if (!value)
return config_error_nonbool(var);
else if (!strcasecmp(value, "auto"))
auto_comment_line_char = 1;
else if (value[0] && !value[1]) {
comment_line_char = value[0];
auto_comment_line_char = 0;
} else
return error("core.commentChar should only be one character");
return 0;
}And I think I misread this piece of code.
We only update comment_line_char from the default "#" when the configured value is a single-byte character and we ignore incorrect values in the configuration file. So I think the patch you sent is correct after all.