Re: [PATCH 07/10] config API: add and use "lookup_value" functions
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 27, 2022, 19:42 UTC
- Message-ID
- <xmqqczadkq9f.fsf@gitster.g>
- In-Reply-To
- <patch-07.10-c01f7d85c94-20221026T151328Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> Change various users of the config API who only wanted to ask if a > configuration key existed to use a new *_config*_lookup_value() family > of functions. Unlike the existing API functions in the API this one > doesn't take a "dest" argument.
When I hear "lookup-value", the first thing I would expect was "look-up by value" (i.e. the reverse look-up to find key). That is not what is going on.
What is presented here is "does the key have corresponding value defined in the configuration system, yes/no?", isn't it?
I would expect such a function to be named *_config_key_exists().
Show 10 quoted lines
> diff --git a/config.h b/config.h > index a5710c5856e..cf1ae7862a8 100644 > --- a/config.h > +++ b/config.h > @@ -502,6 +502,8 @@ void git_configset_clear(struct config_set *cs); > * is owned by the cache. > */ > int git_configset_get_value(struct config_set *cs, const char *key, const char **dest); > +RESULT_MUST_BE_USED > +int git_configset_lookup_value(struct config_set *cs, const char *key);
This must be documented, especially if we give it such a bad name ;-).