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
This commit is contained in:
Junio C Hamano
2023-07-06 11:54:48 -07:00
103 changed files with 960 additions and 632 deletions

View File

@ -564,7 +564,8 @@ static int cmd_log_walk(struct rev_info *rev)
return retval;
}
static int git_log_config(const char *var, const char *value, void *cb)
static int git_log_config(const char *var, const char *value,
const struct config_context *ctx, void *cb)
{
const char *slot_name;
@ -573,7 +574,7 @@ static int git_log_config(const char *var, const char *value, void *cb)
if (!strcmp(var, "format.subjectprefix"))
return git_config_string(&fmt_patch_subject_prefix, var, value);
if (!strcmp(var, "format.filenamemaxlength")) {
fmt_patch_name_max = git_config_int(var, value);
fmt_patch_name_max = git_config_int(var, value, ctx->kvi);
return 0;
}
if (!strcmp(var, "format.encodeemailheaders")) {
@ -613,7 +614,7 @@ static int git_log_config(const char *var, const char *value, void *cb)
return 0;
}
return git_diff_ui_config(var, value, cb);
return git_diff_ui_config(var, value, ctx, cb);
}
int cmd_whatchanged(int argc, const char **argv, const char *prefix)
@ -979,7 +980,8 @@ static enum cover_from_description parse_cover_from_description(const char *arg)
die(_("%s: invalid cover from description mode"), arg);
}
static int git_format_config(const char *var, const char *value, void *cb)
static int git_format_config(const char *var, const char *value,
const struct config_context *ctx, void *cb)
{
if (!strcmp(var, "format.headers")) {
if (!value)
@ -1108,7 +1110,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
if (!strcmp(var, "diff.noprefix"))
return 0;
return git_log_config(var, value, cb);
return git_log_config(var, value, ctx, cb);
}
static const char *output_directory = NULL;