aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2017-04-17 17:10:00 +0700
committerJunio C Hamano <gitster@pobox.com>2017-04-17 19:18:40 -0700
commitc48f4b379eb3a0d093f5a87cce1d2ed6c175104f (patch)
tree1d2ed277b359a1026b12d0bc9ad08d6aab0ca21a /config.c
parent584f8975d2d9530a34bd0b936ae774f82fe30fed (diff)
downloadgit-c48f4b379eb3a0d093f5a87cce1d2ed6c175104f.tar.gz
git-c48f4b379eb3a0d093f5a87cce1d2ed6c175104f.tar.xz
config: prepare to pass more info in git_config_with_options()
So far we can only pass one flag, respect_includes, to thie function. We need to pass some more (non-flag even), so let's make it accept a struct instead of an integer. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/config.c b/config.c
index 1a4d85537..042321a3a 100644
--- a/config.c
+++ b/config.c
@@ -1530,13 +1530,14 @@ static int do_git_config_sequence(config_fn_t fn, void *data)
int git_config_with_options(config_fn_t fn, void *data,
struct git_config_source *config_source,
- int respect_includes)
+ const struct config_options *opts)
{
struct config_include_data inc = CONFIG_INCLUDE_INIT;
- if (respect_includes) {
+ if (opts->respect_includes) {
inc.fn = fn;
inc.data = data;
+ inc.opts = opts;
fn = git_config_include;
data = &inc;
}
@@ -1557,7 +1558,10 @@ int git_config_with_options(config_fn_t fn, void *data,
static void git_config_raw(config_fn_t fn, void *data)
{
- if (git_config_with_options(fn, data, NULL, 1) < 0)
+ struct config_options opts = {0};
+
+ opts.respect_includes = 1;
+ if (git_config_with_options(fn, data, NULL, &opts) < 0)
/*
* git_config_with_options() normally returns only
* zero, as most errors are fatal, and
@@ -1597,9 +1601,11 @@ static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)
void read_early_config(config_fn_t cb, void *data)
{
+ struct config_options opts = {0};
struct strbuf buf = STRBUF_INIT;
- git_config_with_options(cb, data, NULL, 1);
+ opts.respect_includes = 1;
+ git_config_with_options(cb, data, NULL, &opts);
/*
* When setup_git_directory() was not yet asked to discover the
@@ -1615,7 +1621,7 @@ void read_early_config(config_fn_t cb, void *data)
memset(&repo_config, 0, sizeof(repo_config));
strbuf_addstr(&buf, "/config");
repo_config.file = buf.buf;
- git_config_with_options(cb, data, &repo_config, 1);
+ git_config_with_options(cb, data, &repo_config, &opts);
}
strbuf_release(&buf);
}