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

@@ -140,7 +140,8 @@ static enum deny_action parse_deny_action(const char *var, const char *value)
return DENY_IGNORE;
}
static int receive_pack_config(const char *var, const char *value, void *cb)
static int receive_pack_config(const char *var, const char *value,
const struct config_context *ctx, void *cb)
{
int status = parse_hide_refs_config(var, value, "receive", &hidden_refs);
@@ -158,12 +159,12 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
}
if (strcmp(var, "receive.unpacklimit") == 0) {
receive_unpack_limit = git_config_int(var, value);
receive_unpack_limit = git_config_int(var, value, ctx->kvi);
return 0;
}
if (strcmp(var, "transfer.unpacklimit") == 0) {
transfer_unpack_limit = git_config_int(var, value);
transfer_unpack_limit = git_config_int(var, value, ctx->kvi);
return 0;
}
@@ -231,7 +232,7 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
return git_config_string(&cert_nonce_seed, var, value);
if (strcmp(var, "receive.certnonceslop") == 0) {
nonce_stamp_slop_limit = git_config_ulong(var, value);
nonce_stamp_slop_limit = git_config_ulong(var, value, ctx->kvi);
return 0;
}
@@ -246,12 +247,12 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
}
if (strcmp(var, "receive.keepalive") == 0) {
keepalive_in_sec = git_config_int(var, value);
keepalive_in_sec = git_config_int(var, value, ctx->kvi);
return 0;
}
if (strcmp(var, "receive.maxinputsize") == 0) {
max_input_size = git_config_int64(var, value);
max_input_size = git_config_int64(var, value, ctx->kvi);
return 0;
}
@@ -267,7 +268,7 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
return 0;
}
return git_default_config(var, value, cb);
return git_default_config(var, value, ctx, cb);
}
static void show_ref(const char *path, const struct object_id *oid)