Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2023-06-28 22:26:27 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-29 00:06:40 +0300
commit8868b1ebfb8274a3ef90e1ba69ed45be94f6c3fb (patch)
tree24c7285d318bc7573aa6e89efcc8edf3e1d74f0d /builtin/commit.c
parentdc9020849773393e47c37c2834a5582374b55ecc (diff)
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/commit.c')
-rw-r--r--builtin/commit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 6a2b250332..9fe691470a 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1415,7 +1415,8 @@ static int git_status_config(const char *k, const char *v,
return git_column_config(k, v, "status", &s->colopts);
if (!strcmp(k, "status.submodulesummary")) {
int is_bool;
- s->submodule_summary = git_config_bool_or_int(k, v, &is_bool);
+ s->submodule_summary = git_config_bool_or_int(k, v, ctx->kvi,
+ &is_bool);
if (is_bool && s->submodule_summary)
s->submodule_summary = -1;
return 0;
@@ -1475,11 +1476,11 @@ static int git_status_config(const char *k, const char *v,
}
if (!strcmp(k, "diff.renamelimit")) {
if (s->rename_limit == -1)
- s->rename_limit = git_config_int(k, v);
+ s->rename_limit = git_config_int(k, v, ctx->kvi);
return 0;
}
if (!strcmp(k, "status.renamelimit")) {
- s->rename_limit = git_config_int(k, v);
+ s->rename_limit = git_config_int(k, v, ctx->kvi);
return 0;
}
if (!strcmp(k, "diff.renames")) {
@@ -1625,7 +1626,8 @@ static int git_commit_config(const char *k, const char *v,
}
if (!strcmp(k, "commit.verbose")) {
int is_bool;
- config_commit_verbose = git_config_bool_or_int(k, v, &is_bool);
+ config_commit_verbose = git_config_bool_or_int(k, v, ctx->kvi,
+ &is_bool);
return 0;
}