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

Re: builtin/config: --name-only doesn't imply --show-names in "git config get"

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 22, 2024, 05:57 UTC
Message-ID
<ZsbTPeFIPcqnEd-n@tanuki>
In-Reply-To
<xmqqttfdwq0w.fsf@gitster.g>
On Wed, Aug 21, 2024 at 01:59:43PM -0700, Junio C Hamano wrote:
Show 33 quoted lines
> Yukai Chou <muzimuzhi@gmail.com> writes:
> 
> > Junio C Hamano <gitster@pobox.com> 于2024年8月22日周四 00:07写道:
> >>
> >> Yukai Chou <muzimuzhi@gmail.com> writes:
> >>
> >> > # get empty line(s)
> >> > git config get --all --name-only remote.origin.fetch
> >> > # get lines of name(s)
> >> > git config get --all --show-names --name-only remote.origin.fetch
> >> >
> >> > Either the doc or the behavior of --name-only needs some adjustment.
> >>
> >> This argues for making "all" imply we need to show the name of the
> >> configuration variable,
> >
> > Sorry can you elaborate on what that "all" meant? A new option "--show-all"?
> 
> Sorry, but "--all" is probably a red herring.
> 
> What I wanted to say was that we can 
> 
>  (1) get rid of "--show-name",
> 
>  (2) have the combination of options that can emit values for more
>     than one key to automatically show both name and value, and
> 
>  (3) add "--hide-name" so that such command can still show only the
>      value.
> 
> where I mixed up (2) and "all".  In fact, "--all" is not something
> that gives values for more than one key (it is things like regexp
> and urlmatch).

I wouldn't get rid of `--show-name`, as it also implicitly brings along `--no-show-name`, basically checking the box for (3).

In any case, I agree that it probably makes sense to do (2). Unless I'm mistaken, the only case we need to care about is `--regexp`, because without all the emitted names would be the same anyway.

Patrick
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “builtin/config: --name-only doesn't imply --show-names in "git config get"”
  1. Yukai ChouAug 21, 2024
  2. Junio C HamanoAug 21, 2024
  3. Yukai ChouAug 21, 2024
  4. Junio C HamanoAug 21, 2024
  5. Patrick SteinhardtAug 22, 2024
  6. Junio C HamanoAug 22, 2024

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.