summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorMatthew Rogers <mattr94@gmail.com>2020-02-10 00:30:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-10 18:49:10 (GMT)
commite37efa40e122c4408c89c437e8a375df2147feac (patch)
tree027006df788dfefee7b2fcd28846728ae37e7613 /config.c
parent5c105a842eae59a3271f5db861ef8d85de6bc2f8 (diff)
downloadgit-e37efa40e122c4408c89c437e8a375df2147feac.zip
git-e37efa40e122c4408c89c437e8a375df2147feac.tar.gz
git-e37efa40e122c4408c89c437e8a375df2147feac.tar.bz2
config: teach git_config_source to remember its scope
There are many situations where the scope of a config command is known beforehand, such as passing of '--local', '--file', etc. to an invocation of git config. However, this information is lost when moving from builtin/config.c to /config.c. This historically hasn't been a big deal, but to prepare for the upcoming --show-scope option we teach git_config_source to keep track of the source and the config machinery to use that information to set current_parsing_scope appropriately. Signed-off-by: Matthew Rogers <mattr94@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/config.c b/config.c
index 0e2c693..9b6afca 100644
--- a/config.c
+++ b/config.c
@@ -1763,6 +1763,9 @@ int config_with_options(config_fn_t fn, void *data,
data = &inc;
}
+ if (config_source)
+ current_parsing_scope = config_source->scope;
+
/*
* If we have a specific filename, use it. Otherwise, follow the
* regular lookup sequence.