Re: [PATCHv3 1/2] config: add '--names-only' option to list only variable names
From: Jeff King <hidden>
Date: 2016-06-15 23:06:08
On Mon, Aug 10, 2015 at 11:46:06AM +0200, SZEDER Gábor wrote:
'git config' can only show values or name-value pairs, so if a shell script needs the names of set config variables it has to run 'git config --list' or '--get-regexp' and parse the output to separate config variable names from their values. However, such a parsing can't cope with multi-line values. Though 'git config' can produce null-terminated output for newline-safe parsing, that's of no use in such a case, becase shells can't cope with null characters. Even our own bash completion script suffers from these issues. Help the completion script, and shell scripts in general, by introducing the '--names-only' option to modify the output of '--list' and '--get-regexp' to list only the names of config variables, so they don't have to perform error-prone post processing to separate variable names from their values anymore.
Nice. The whole thing looks very neatly done. I have only one minor nit: the option "--names-only" is _almost_ the same as the "--name-only" diff option which is somewhat similar. Obviously they do different things and do not need to match, but I wonder if it would create less annoyance to just give them the same name. -Peff