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

Re: [PATCH v2 1/2] config: add options to list only variable names

From
Christian Couder <christian.couder@gmail.com>
Date
May 29, 2015, 11:34 UTC
Message-ID
<CAP8UFD2Zhomk+ryRfZFWAVs0yZeXUfpBXTo51Cm=Lj1QbkRbmA@mail.gmail.com>
In-Reply-To
<xmqqbnh4h5k4.fsf@gitster.dls.corp.google.com>
On Thu, May 28, 2015 at 9:20 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> SZEDER Gábor <szeder@ira.uka.de> writes:
>
>> @@ -16,11 +16,12 @@ SYNOPSIS
>>  'git config' [<file-option>] [type] [-z|--null] --get-all name [value_regex]
>>  'git config' [<file-option>] [type] [-z|--null] --get-regexp name_regex [value_regex]
>>  'git config' [<file-option>] [type] [-z|--null] --get-urlmatch name URL
>> +'git config' [<file-option>] [-z|--null] --get-name-regexp name_regex
>> ...
>
> At first I wondered why --get-name-regexp is needed, as (purely from
> the syntactic level) it appeared at the first glance the existing
> '--get-regexp' without 'value_regex' may be sufficient, until I read
> this:
>
>> +--get-name-regexp::
>> +     Like --get-regexp, but shows only matching variable names, not its
>> +     values.
>
> which makes it clear why it is needed.  The distinction is purely
> about the output, i.e. the values are omitted.

If the distinction is purely about the output, then it seems logical to add only an output related option, like the --name-only option I suggested, and not 2 new modes (--get-name-regexp and --list-names).

Doesn't it look like git config already has too many modes?
Show 9 quoted lines
> But then it makes me wonder why --get-name-regexp shouldn't
> optionally accept value_regex like --get-regexp does, allowing you
> to say "list the variables that match this pattern whose values
> match this other pattern".  I know it may be a feature that is
> unnecessary for your purpose, but from a cursory look of the patch
> text, you do not seem to be doing anything different between
> get-regexp and get-name-regexp codepaths other than flipping
> omit_values bit on, so it could be that the feature is already
> supported but forgot to document it, perhaps?

This also suggests that it might be more logical to only add an option called --name-only or --omit-values that would map directly to the omit_values bit in the code.

Previous: Junio C HamanoNext: Jeff King
Message 14 of 17 in “config: add options to list only variable names”
  1. 1/2 config: add options to list only variable namesSZEDER Gábor, May 27, 2015
  2. 2/2 completion: use new 'git config' options to reliably list variable namesSZEDER Gábor, May 27, 2015
  3. 5/2 config: add options to list only variable namesSZEDER Gábor, May 27, 2015
  4. Christian CouderMay 28, 2015
  5. Jeff KingMay 27, 2015
  6. Jeff KingMay 27, 2015
  7. Jeff KingMay 27, 2015
  8. SZEDER GáborMay 27, 2015
  9. Junio C HamanoMay 27, 2015
  10. 0/2 config: list only variable names for completionSZEDER Gábor, May 28, 2015
  11. 1/2 config: add options to list only variable namesSZEDER Gábor, May 28, 2015
  12. Junio C HamanoMay 28, 2015
  13. Junio C HamanoMay 28, 2015
  14. Christian CouderMay 29, 2015
  15. Jeff KingMay 29, 2015
  16. 2/2 completion: use new 'git config' options to reliably list variable namesSZEDER Gábor, May 28, 2015
  17. Jeff KingMay 28, 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.