git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Kyle J. McKay" <mackyle@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH v6 6/6] config: "git config --get-urlmatch" parses section.<url>.key
Date: Thu, 1 Aug 2013 10:30:11 -0700	[thread overview]
Message-ID: <20130801173010.GB16562@sigill.intra.peff.net> (raw)
In-Reply-To: <7vob9hs4qu.fsf@alter.siamese.dyndns.org>

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

  reply	other threads:[~2013-08-01 17:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 19:26 [PATCH v6 0/6] http.<url>.<key> and friends Junio C Hamano
2013-07-31 19:26 ` [PATCH v6 1/6] http.c: fix parsing of http.sslCertPasswordProtected variable Junio C Hamano
2013-07-31 19:26 ` [PATCH v6 2/6] config: add helper to normalize and match URLs Junio C Hamano
2013-07-31 20:50   ` Kyle J. McKay
2013-07-31 19:26 ` [PATCH v6 3/6] config: add generic callback wrapper to parse section.<url>.key Junio C Hamano
2013-07-31 19:26 ` [PATCH v6 4/6] config: parse http.<url>.<variable> using urlmatch Junio C Hamano
2013-07-31 20:51   ` Kyle J. McKay
2013-07-31 20:51   ` [PATCH ALTERNATIVE v6 0/2] http.<url>.<key> and friends Kyle J. McKay
2013-07-31 20:52     ` [PATCH ALTERNATIVE v6 2/4] config: add helper to normalize and match URLs Kyle J. McKay
2013-07-31 20:52     ` [PATCH ALTERNATIVE v6 4/4] config: parse http.<url>.<variable> using urlmatch Kyle J. McKay
2013-07-31 22:01     ` [PATCH ALTERNATIVE v6 0/2] http.<url>.<key> and friends Junio C Hamano
2013-07-31 22:41     ` [PATCH ALTERNATIVE v6.v2 4/6] config: parse http.<url>.<variable> using urlmatch Kyle J. McKay
2013-07-31 19:26 ` [PATCH v6 5/6] builtin/config: refactor collect_config() Junio C Hamano
2013-07-31 19:26 ` [PATCH v6 6/6] config: "git config --get-urlmatch" parses section.<url>.key Junio C Hamano
2013-07-31 22:45   ` Jeff King
2013-07-31 23:03     ` Kyle J. McKay
2013-07-31 23:44       ` Jeff King
2013-08-01 17:25         ` Junio C Hamano
2013-08-01 17:30           ` Jeff King [this message]
2013-08-05 20:20       ` [PATCH ALTERNATIVE v6.v3 4/6] config: parse http.<url>.<variable> using urlmatch Kyle J. McKay
2013-08-05 22:56         ` Junio C Hamano
2013-08-05 23:57           ` Kyle J. McKay
2013-07-31 23:47     ` [PATCH v6 6/6] config: "git config --get-urlmatch" parses section.<url>.key Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130801173010.GB16562@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mackyle@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).