From: Junio C Hamano Date: Wed, 21 Aug 2024 20:59:43 GMT Subject: Re: builtin/config: --name-only doesn't imply --show-names in "git config get" Message-ID: In-Reply-To: Yukai Chou writes: > Junio C Hamano 于2024年8月22日周四 00:07写道: >> >> Yukai Chou 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). For example: $ git config --get-regexp 'sendemail\..*' would show values for more than one variable, and depending on the variable, it may show the values for one variable more than once. According to the documentation, this was replaced with --get-regexp :: Replaced by `git config get --all --show-names --regexp `. but it could have been git config get --all --regexp as it is clear --regexp could give results for more than one key. This points at a bug in the documentation, by the way. "git config --get-all" is described like so: --get-all []:: Replaced by `git config get [--value=] --all --show-names `. but this gives values for only one key, and the command does not show key names. It is replaced by git config get [--value=] --all without "--show-names".