Re: [PATCH 1/2] config: add options to list only variable names
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 27, 2015, 22:20 UTC
- Message-ID
- <xmqqd21lk6h2.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1432757240-4445-1-git-send-email-szeder@ira.uka.de>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 9 quoted lines
> 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".
Show 7 quoted lines
> - 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()?