diff options
author | Glen Choo <chooglen@google.com> | 2023-06-28 21:26:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-28 23:06:40 +0200 |
commit | 8868b1ebfb8274a3ef90e1ba69ed45be94f6c3fb (patch) | |
tree | 24c7285d318bc7573aa6e89efcc8edf3e1d74f0d /builtin/submodule--helper.c | |
parent | trace2: plumb config kvi (diff) | |
download | git-8868b1ebfb8274a3ef90e1ba69ed45be94f6c3fb.tar.xz git-8868b1ebfb8274a3ef90e1ba69ed45be94f6c3fb.zip |
config: pass kvi to die_bad_number()
Plumb "struct key_value_info" through all code paths that end in
die_bad_number(), which lets us remove the helper functions that read
analogous values from "struct config_reader". As a result, nothing reads
config_reader.config_kvi any more, so remove that too.
In config.c, this requires changing the signature of
git_configset_get_value() to 'return' "kvi" in an out parameter so that
git_configset_get_<type>() can pass it to git_config_<type>(). Only
numeric types will use "kvi", so for non-numeric types (e.g.
git_configset_get_string()), pass NULL to indicate that the out
parameter isn't needed.
Outside of config.c, config callbacks now need to pass "ctx->kvi" to any
of the git_config_<type>() functions that parse a config string into a
number type. Included is a .cocci patch to make that refactor.
The only exceptional case is builtin/config.c, where git_config_<type>()
is called outside of a config callback (namely, on user-provided input),
so config source information has never been available. In this case,
die_bad_number() defaults to a generic, but perfectly descriptive
message. Let's provide a safe, non-NULL for "kvi" anyway, but make sure
not to change the message.
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r-- | builtin/submodule--helper.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index f8e9d85e77..57185cf5f3 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2192,13 +2192,13 @@ static int update_clone_task_finished(int result, } static int git_update_clone_config(const char *var, const char *value, - const struct config_context *ctx UNUSED, + const struct config_context *ctx, void *cb) { int *max_jobs = cb; if (!strcmp(var, "submodule.fetchjobs")) - *max_jobs = parse_submodule_fetchjobs(var, value); + *max_jobs = parse_submodule_fetchjobs(var, value, ctx->kvi); return 0; } |