Re: [PATCH v7 5/8] config: add `git_die_config()` to the config-set API
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Aug 5, 2014, 15:15 UTC
- Message-ID
- <vpqiom72cj4.fsf@anie.imag.fr>
- In-Reply-To
- <53E0F057.1040706@gmail.com>
Tanay Abhra <tanayabh@gmail.com> writes:
Show 29 quoted lines
> Matthieu, I have finished the new version, but instead of flooding the mailing list with
> a series again, I wanted to confirm if the new git_config_die() is alright.
>
> NORETURN __attribute__((format(printf, 2, 3)))
> void git_die_config(const char *key, const char *err, ...)
> {
> const struct string_list *values;
> struct key_value_info *kv_info;
>
> if (err) {
> va_list params;
> va_start(params, err);
> vreportf("error: ", err, params);
> va_end(params);
> }
> values = git_config_get_value_multi(key);
> kv_info = values->items[values->nr - 1].util;
> git_die_config_linenr(key, kv_info->filename, kv_info->linenr);
> }
>
> Currently works like the old git_config() error reporting path. If err is set to "NULL",
> it would print no error message and just the die message. If given something like,
>
> git_config_die(key, "value '%s' is not allowed", value);
>
> it would print,
>
> error: value '3' is not allowed
> fatal: bad config variable 'core.frotz' at file line 15 in .git/configThat seems to be a good step forward.
I think we would also want to improve the error message, but that shouldn't block your series from inclusion: we can do that later without API change.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/