git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] completion: add a helper function to get config variables

From
Junio C Hamano <gitster@pobox.com>
Date
May 12, 2015, 22:14 UTC
Message-ID
<xmqqa8x9e93w.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1431262218-7304-1-git-send-email-szeder@ira.uka.de>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 6 quoted lines
> +	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.
Previous: SZEDER Gábor
Message 4 of 4 in “completion: add a helper function to get config variables”
  1. 1/2 completion: add a helper function to get config variablesSZEDER Gábor, May 10, 2015
  2. 2/2 completion: simplify query for config variablesSZEDER Gábor, May 10, 2015
  3. SZEDER GáborMay 10, 2015
  4. Junio C HamanoMay 12, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.