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:
authorJunio C Hamano <gitster@pobox.com>2023-07-06 21:54:48 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-06 21:54:48 +0300
commitb3d1c85d4833aef546f11e4d37516a1ececaefc3 (patch)
treeb5e799c3279f98f5172ce18cfd0e9b317e9822dd /trace2/tr2_cfg.c
parent1d76e69212102c3373b552186590b76d6ad8d84c (diff)
parent6e8e7981eb86e2c19401825dbdb55d5860d11313 (diff)
Merge branch 'gc/config-context'
Reduce reliance on a global state in the config reading API. * gc/config-context: config: pass source to config_parser_event_fn_t config: add kvi.path, use it to evaluate includes config.c: remove config_reader from configsets config: pass kvi to die_bad_number() trace2: plumb config kvi config.c: pass ctx with CLI config config: pass ctx with config files config.c: pass ctx in configsets config: add ctx arg to config_fn_t urlmatch.h: use config_fn_t type config: inline git_color_default_config
Diffstat (limited to 'trace2/tr2_cfg.c')
-rw-r--r--trace2/tr2_cfg.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c
index db817a80c5..d96d908bb9 100644
--- a/trace2/tr2_cfg.c
+++ b/trace2/tr2_cfg.c
@@ -100,7 +100,8 @@ struct tr2_cfg_data {
/*
* See if the given config key matches any of our patterns of interest.
*/
-static int tr2_cfg_cb(const char *key, const char *value, void *d)
+static int tr2_cfg_cb(const char *key, const char *value,
+ const struct config_context *ctx, void *d)
{
struct strbuf **s;
struct tr2_cfg_data *data = (struct tr2_cfg_data *)d;
@@ -109,7 +110,8 @@ static int tr2_cfg_cb(const char *key, const char *value, void *d)
struct strbuf *buf = *s;
int wm = wildmatch(buf->buf, key, WM_CASEFOLD);
if (wm == WM_MATCH) {
- trace2_def_param_fl(data->file, data->line, key, value);
+ trace2_def_param_fl(data->file, data->line, key, value,
+ ctx->kvi);
return 0;
}
}
@@ -127,8 +129,10 @@ void tr2_cfg_list_config_fl(const char *file, int line)
void tr2_list_env_vars_fl(const char *file, int line)
{
+ struct key_value_info kvi = KVI_INIT;
struct strbuf **s;
+ kvi_from_param(&kvi);
if (tr2_load_env_vars() <= 0)
return;
@@ -136,15 +140,19 @@ void tr2_list_env_vars_fl(const char *file, int line)
struct strbuf *buf = *s;
const char *val = getenv(buf->buf);
if (val && *val)
- trace2_def_param_fl(file, line, buf->buf, val);
+ trace2_def_param_fl(file, line, buf->buf, val, &kvi);
}
}
void tr2_cfg_set_fl(const char *file, int line, const char *key,
const char *value)
{
+ struct key_value_info kvi = KVI_INIT;
+ struct config_context ctx = {
+ .kvi = &kvi,
+ };
struct tr2_cfg_data data = { file, line };
if (tr2_cfg_load_patterns() > 0)
- tr2_cfg_cb(key, value, &data);
+ tr2_cfg_cb(key, value, &ctx, &data);
}