All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: peff@peff.net, git@vger.kernel.org
Subject: Re: [PATCH] refs: parse_hide_refs_config to use parse_config_key
Date: Fri, 24 Feb 2017 12:47:38 -0800	[thread overview]
Message-ID: <xmqqd1e71fkl.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170224204335.10652-1-sbeller@google.com> (Stefan Beller's message of "Fri, 24 Feb 2017 12:43:35 -0800")

Stefan Beller <sbeller@google.com> writes:

> parse_config_key was introduced in 1b86bbb0ade (config: add helper
> function for parsing key names, 2013-01-22), the NEEDSWORK that is removed
> in this patch was introduced at daebaa7813 (upload/receive-pack: allow
> hiding ref hierarchies, 2013-01-18), which is only a couple days apart,
> so presumably the code replaced in this patch was only introduced due
> to not wanting to wait on the proper helper function being available.
>
> Make the condition easier to read by using parse_config_key.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  refs.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index cd36b64ed9..21bc8c9101 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1034,10 +1034,11 @@ static struct string_list *hide_refs;
>  
>  int parse_hide_refs_config(const char *var, const char *value, const char *section)
>  {
> +	const char *subsection, *key;
> +	int subsection_len;
>  	if (!strcmp("transfer.hiderefs", var) ||
> -	    /* NEEDSWORK: use parse_config_key() once both are merged */
> -	    (starts_with(var, section) && var[strlen(section)] == '.' &&
> -	     !strcmp(var + strlen(section), ".hiderefs"))) {
> +	    (!parse_config_key(var, section, &subsection, &subsection_len, &key)
> +	    && !subsection && !strcmp(key, "hiderefs"))) {
>  		char *ref;
>  		int len;

Thanks for noticing.  "once both are merged" is a cryptic comment to
leave when somebody knows which two topics make "both" ;-)

  parent reply	other threads:[~2017-02-24 20:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24 20:33 [PATCH] refs: parse_hide_refs_config to use parse_config_key Stefan Beller
2017-02-24 20:39 ` Jeff King
2017-02-24 20:43   ` Stefan Beller
2017-02-24 20:47     ` Jeff King
2017-02-24 20:47     ` Junio C Hamano [this message]
2017-02-24 21:06   ` Jeff King
2017-02-24 21:07     ` [PATCH 1/3] parse_config_key: use skip_prefix instead of starts_with Jeff King
2017-02-24 21:08     ` [PATCH 2/3] parse_config_key: allow matching single-level config Jeff King
2017-02-24 21:20       ` Junio C Hamano
2017-02-24 21:25         ` Junio C Hamano
2017-02-24 21:26         ` Jeff King
2017-02-24 21:08     ` [PATCH 3/3] parse_hide_refs_config: tell parse_config_key we don't want a subsection Jeff King
2017-02-24 23:28       ` Stefan Beller
2017-02-24 21:18     ` [PATCH] refs: parse_hide_refs_config to use parse_config_key Junio C Hamano
2017-02-24 21:20       ` Jeff King
2017-02-24 21:24         ` 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

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

  git send-email \
    --in-reply-to=xmqqd1e71fkl.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sbeller@google.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.