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
Junio C Hamano <gitster@pobox.com>
Date
Aug 21, 2024, 16:06 UTC
Message-ID
<xmqqttfd2734.fsf@gitster.g>
In-Reply-To
<CAEg0tHTWzgD5bw3oK7-Rtv9oTymqyhvZz3bcJ7yNRhF8wXMLGA@mail.gmail.com>
Yukai Chou <muzimuzhi@gmail.com> writes:
Show 18 quoted lines
> The v2.46.0 doc of git-config(1) says
>
>> --name-only
>> Output only the names of config variables for `list` or `get`.
> https://git-scm.com/docs/git-config#Documentation/git-config.txt---name-only
>
> But the behavior of --name-only is more like "disable non-name outputs
> and leave the output state of names as-is". Thus using --name-only
> alone, one gets totally empty lines (which might be weird); only using
> --name-only and --show-names together, can one get output of just
> names.
>
> # 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, and introducing an option "--hide-name" to omit the name. That way, you'd need to give clearly contradicting "--hide-name" and "--name-only" together to get a nonsense output.

Previous: Yukai ChouNext: Yukai Chou
Message 2 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.