builtin/config: --name-only doesn't imply --show-names in "git config get"
- From
Yukai Chou <muzimuzhi@gmail.com>
- Date
- Aug 21, 2024, 08:10 UTC
- Message-ID
- <CAEg0tHTWzgD5bw3oK7-Rtv9oTymqyhvZz3bcJ7yNRhF8wXMLGA@mail.gmail.com>
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.
Yukai Chou