Re: [BUG] submodule config does not apply to upper case submodules?
- From
Stefan Beller <sbeller@google.com>
- Date
- Feb 15, 2017, 23:28 UTC
- Message-ID
- <CAGZ79kaKhjNPGRVJ6H=CMKQ1RKXmVvSPOMo4c3haNeS60aWQXA@mail.gmail.com>
- In-Reply-To
- <xmqqtw7v123n.fsf@gitster.mtv.corp.google.com>
On Wed, Feb 15, 2017 at 3:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Jonathan Tan <jonathantanmy@google.com> writes:
>>
>>> I had some time to look into this, and yes, command-line parameters
>>> are too aggressively downcased ("git_config_parse_parameter" calls
>>> "strbuf_tolower" on the entire key part in config.c).
>>
>> Ahh, thanks. So this is not about submodules at all; it is -c var=VAL
>> where var is downcased too aggressively.
>
> Perhaps something like this?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)
Show 16 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.
Show 12 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); > +} > + > int git_config_parse_parameter(const char *text, > config_fn_t fn, void *data)