On Thu, Aug 01, 2013 at 10:25:13AM -0700, Junio C Hamano wrote:

> > diff --git a/builtin/config.c b/builtin/config.c
> > index c35c5be..9328a90 100644
> > --- a/builtin/config.c
> > +++ b/builtin/config.c
> > @@ -589,7 +589,9 @@ int cmd_config(int argc, const char **argv, const char 
> > *prefix)
> >     }
> >     else if (actions == ACTION_GET_URLMATCH) {
> >             check_argc(argc, 2, 2);
> > -           return get_urlmatch(argv[0], argv[1]);
> > +           if (git_config_parse_key(argv[0], &key, NULL))
> > +                   return CONFIG_INVALID_KEY;
> > +           return get_urlmatch(key, argv[1]);
> >     }
> >     else if (actions == ACTION_UNSET) {
> >             check_argc(argc, 1, 2);
> 
> If we drop the "list every key in section.*" mode, the above should
> be sufficient, I think.

Ah, right, forgot about that again.

> I do not know how useful it would be to be for a scripted Porcelain
> to be able to ask
> 
>     $ git config --get-urlmatch http https://weak.example.com/path/to/git.git
> 
> and get all the "http.*" variables that will apply to the given URL.

I do not think it is all that useful, but I don't think it hurts too
much to have it (and it would be a hard operation to do otherwise). The
implementation you posted that downcases as we memdup the key makes
sense to me.

The key thing is that it is done only by git-config, as we would not
want to pay the allocation cost for every config key we look at during a
git_config() run, but I think your implementation is fine in that
respect.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to