Subject: Re: [PATCH 1/2] config: add options to list only variable names

From: Junio C Hamano <[email-masked]>
Date: Wed, 27 May 2015 15:20:41 -0700

SZEDER Gábor <[email-masked]> writes:

> diff --git a/builtin/config.c b/builtin/config.c
> index 7188405..38bcf83 100644
> --- a/builtin/config.c
> +++ b/builtin/config.c
> @@ -13,6 +13,7 @@ static char *key;
>  static regex_t *key_regexp;
>  static regex_t *regexp;
>  static int show_keys;
> +static int show_only_keys;

Is it just me who thinks this is a strange phrase?  Somehow these
words do not roll well on my tongue.

Perhaps "static int omit_values"?  Which would match what this part
does pretty well:

>  static int show_all_config(const char *key_, const char *value_, void *cb)
>  {
> -	if (value_)
> +	if (!show_only_keys && value_)

That is, "if not omitting values and there is a value, then do this".

> -	return format_config(&values->items[values->nr++], key_, value_);
> +	if (show_only_keys) {
> +		struct strbuf *buf = &values->items[values->nr++];
> +		strbuf_init(buf, 0);
> +		strbuf_addstr(buf, key_);
> +		strbuf_addch(buf, term);
> +		return 0;

xstrfmt()?