diff options
author | Matthew Rogers <mattr94@gmail.com> | 2020-02-10 01:30:57 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-10 19:49:10 +0100 |
commit | e37efa40e122c4408c89c437e8a375df2147feac (patch) | |
tree | 027006df788dfefee7b2fcd28846728ae37e7613 /config.h | |
parent | config: preserve scope in do_git_config_sequence (diff) | |
download | git-e37efa40e122c4408c89c437e8a375df2147feac.tar.xz git-e37efa40e122c4408c89c437e8a375df2147feac.zip |
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 '')
-rw-r--r-- | config.h | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -35,10 +35,21 @@ struct object_id; #define CONFIG_REGEX_NONE ((void *)1) +enum config_scope { + CONFIG_SCOPE_UNKNOWN = 0, + CONFIG_SCOPE_SYSTEM, + CONFIG_SCOPE_GLOBAL, + CONFIG_SCOPE_LOCAL, + CONFIG_SCOPE_WORKTREE, + CONFIG_SCOPE_COMMAND, +}; +const char *config_scope_name(enum config_scope scope); + struct git_config_source { unsigned int use_stdin:1; const char *file; const char *blob; + enum config_scope scope; }; enum config_origin_type { @@ -294,16 +305,6 @@ int config_error_nonbool(const char *); int git_config_parse_parameter(const char *, config_fn_t fn, void *data); -enum config_scope { - CONFIG_SCOPE_UNKNOWN = 0, - CONFIG_SCOPE_SYSTEM, - CONFIG_SCOPE_GLOBAL, - CONFIG_SCOPE_LOCAL, - CONFIG_SCOPE_WORKTREE, - CONFIG_SCOPE_COMMAND, -}; -const char *config_scope_name(enum config_scope scope); - enum config_scope current_config_scope(void); const char *current_config_origin_type(void); const char *current_config_name(void); |