git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Yukai Chou <muzimuzhi@gmail.com>
Cc: git@vger.kernel.org,  ps@pks.im
Subject: Re: builtin/config: --name-only doesn't imply --show-names in "git config get"
Date: Wed, 21 Aug 2024 09:06:55 -0700	[thread overview]
Message-ID: <xmqqttfd2734.fsf@gitster.g> (raw)
In-Reply-To: <CAEg0tHTWzgD5bw3oK7-Rtv9oTymqyhvZz3bcJ7yNRhF8wXMLGA@mail.gmail.com> (Yukai Chou's message of "Wed, 21 Aug 2024 16:10:33 +0800")

Yukai Chou <muzimuzhi@gmail.com> writes:

> 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.

  reply	other threads:[~2024-08-21 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  8:10 builtin/config: --name-only doesn't imply --show-names in "git config get" Yukai Chou
2024-08-21 16:06 ` Junio C Hamano [this message]
2024-08-21 20:28   ` Yukai Chou
2024-08-21 20:59     ` Junio C Hamano
2024-08-22  5:57       ` Patrick Steinhardt
2024-08-22 14:54         ` Junio C Hamano

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=xmqqttfd2734.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=muzimuzhi@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).