Re: [BUG] submodule config does not apply to upper case submodules?
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 15, 2017, 23:37 UTC
- Message-ID
- <xmqqh93v10vy.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAGZ79kaKhjNPGRVJ6H=CMKQ1RKXmVvSPOMo4c3haNeS60aWQXA@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> Yes; though I'd place it in strbuf.{c,h} as it is operating
> on the internals of the strbuf. (Do we make any promises outside of
> strbuf about the internals? I mean we use .buf all the time, so maybe
> I am overly cautious here)I'd rather have it not use struct strbuf as an interface. It only needs to pass "char *" and its promise that it touches the string in-place without changing the length need to be documented as a comment before the function.
Show 19 quoted lines
>> config.c | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/config.c b/config.c
>> index c6b874a7bf..98bf8fee32 100644
>> --- a/config.c
>> +++ b/config.c
>> @@ -201,6 +201,20 @@ void git_config_push_parameter(const char *text)
>> strbuf_release(&env);
>> }
>>
>> +static void canonicalize_config_variable_name(struct strbuf *var)
>> +{
>> + char *first_dot = strchr(var->buf, '.');
>> + char *last_dot = strrchr(var->buf, '.');
>
> If first_dot != NULL, then last_dot !+ NULL as well.
> (either both are NULL or none of them),
> so we can loose one condition below.I do not think it is worth it, though.
Show 8 quoted lines
>> + char *cp; >> + >> + if (first_dot) >> + for (cp = var->buf; *cp && cp < first_dot; cp++) >> + *cp = tolower(*cp); >> + if (last_dot) >> + for (cp = last_dot; *cp; cp++) >> + *cp = tolower(*cp);
if (first_dot) {
scan up to first dot
if (last_dot)
scan from last dot to the end
}would be uglier.