public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "SZEDER Gábor" <szeder@ira•uka.de>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 1/2] completion: add a helper function to get config variables
Date: Tue, 12 May 2015 15:14:59 -0700	[thread overview]
Message-ID: <xmqqa8x9e93w.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1431262218-7304-1-git-send-email-szeder@ira.uka.de> ("SZEDER Gábor"'s message of "Sun, 10 May 2015 14:50:17 +0200")

SZEDER Gábor <szeder@ira•uka.de> writes:

> +	for i in $(git --git-dir="$(__gitdir)" config --get-regexp "$section\..*" 2>/dev/null); do
>  		case "$i" in
> -		pretty.*)
> -			i="${i#pretty.}"
> +		$section.*)
> +			i="${i#$section.}"

The case arm treats $section as a shell glob, --get-regexp treats it
as a regex fragment and then the shell expansion uses it as a
literal.

The current set of callers give simple single-token like pretty,
remote, etc. to it so this is safe, but you may want to give a
comment to the function to help future generation, perhaps?

Other than that, looks quite straight-forward.

Thanks.

      parent reply	other threads:[~2015-05-12 22:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-10 12:50 [PATCH 1/2] completion: add a helper function to get config variables SZEDER Gábor
2015-05-10 12:50 ` [PATCH 2/2] completion: simplify query for " SZEDER Gábor
2015-05-10 13:16 ` [PATCH 1/2] completion: add a helper function to get " SZEDER Gábor
2015-05-12 22:14 ` Junio C Hamano [this message]

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=xmqqa8x9e93w.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=szeder@ira$(echo .)uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox