Merge branch 'gc/config-context' into next
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:
18
setup.c
18
setup.c
@ -522,7 +522,9 @@ no_prevention_needed:
|
||||
startup_info->original_cwd = NULL;
|
||||
}
|
||||
|
||||
static int read_worktree_config(const char *var, const char *value, void *vdata)
|
||||
static int read_worktree_config(const char *var, const char *value,
|
||||
const struct config_context *ctx UNUSED,
|
||||
void *vdata)
|
||||
{
|
||||
struct repository_format *data = vdata;
|
||||
|
||||
@ -593,13 +595,14 @@ static enum extension_result handle_extension(const char *var,
|
||||
return EXTENSION_UNKNOWN;
|
||||
}
|
||||
|
||||
static int check_repo_format(const char *var, const char *value, void *vdata)
|
||||
static int check_repo_format(const char *var, const char *value,
|
||||
const struct config_context *ctx, void *vdata)
|
||||
{
|
||||
struct repository_format *data = vdata;
|
||||
const char *ext;
|
||||
|
||||
if (strcmp(var, "core.repositoryformatversion") == 0)
|
||||
data->version = git_config_int(var, value);
|
||||
data->version = git_config_int(var, value, ctx->kvi);
|
||||
else if (skip_prefix(var, "extensions.", &ext)) {
|
||||
switch (handle_extension_v0(var, value, ext, data)) {
|
||||
case EXTENSION_ERROR:
|
||||
@ -622,7 +625,7 @@ static int check_repo_format(const char *var, const char *value, void *vdata)
|
||||
}
|
||||
}
|
||||
|
||||
return read_worktree_config(var, value, vdata);
|
||||
return read_worktree_config(var, value, ctx, vdata);
|
||||
}
|
||||
|
||||
static int check_repository_format_gently(const char *gitdir, struct repository_format *candidate, int *nongit_ok)
|
||||
@ -1120,7 +1123,8 @@ struct safe_directory_data {
|
||||
int is_safe;
|
||||
};
|
||||
|
||||
static int safe_directory_cb(const char *key, const char *value, void *d)
|
||||
static int safe_directory_cb(const char *key, const char *value,
|
||||
const struct config_context *ctx UNUSED, void *d)
|
||||
{
|
||||
struct safe_directory_data *data = d;
|
||||
|
||||
@ -1176,7 +1180,9 @@ static int ensure_valid_ownership(const char *gitfile,
|
||||
return data.is_safe;
|
||||
}
|
||||
|
||||
static int allowed_bare_repo_cb(const char *key, const char *value, void *d)
|
||||
static int allowed_bare_repo_cb(const char *key, const char *value,
|
||||
const struct config_context *ctx UNUSED,
|
||||
void *d)
|
||||
{
|
||||
enum allowed_bare_repo *allowed_bare_repo = d;
|
||||
|
||||
|
Reference in New Issue
Block a user