summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorMatthew Rogers <mattr94@gmail.com>2020-02-10 00:30:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-02-10 18:32:18 (GMT)
commita5cb4204b63b57e99ae3a44f23a7945f146fe078 (patch)
treee4e539ced905a7164614d498efe6b41d7ee3bf9c /config.c
parent417be08d02ef5df72996972e105d386028c34653 (diff)
downloadgit-a5cb4204b63b57e99ae3a44f23a7945f146fe078.zip
git-a5cb4204b63b57e99ae3a44f23a7945f146fe078.tar.gz
git-a5cb4204b63b57e99ae3a44f23a7945f146fe078.tar.bz2
config: make scope_name non-static and rename it
To prepare for the upcoming --show-scope option, we require the ability to convert a config_scope enum to a string. As this was originally implemented as a static function 'scope_name()' in t/helper/test-config.c, we expose it via config.h and give it a less ambiguous name 'config_scope_name()' 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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/config.c b/config.c
index d75f88c..a922b13 100644
--- a/config.c
+++ b/config.c
@@ -3297,6 +3297,22 @@ const char *current_config_origin_type(void)
}
}
+const char *config_scope_name(enum config_scope scope)
+{
+ switch (scope) {
+ case CONFIG_SCOPE_SYSTEM:
+ return "system";
+ case CONFIG_SCOPE_GLOBAL:
+ return "global";
+ case CONFIG_SCOPE_REPO:
+ return "repo";
+ case CONFIG_SCOPE_CMDLINE:
+ return "cmdline";
+ default:
+ return "unknown";
+ }
+}
+
const char *current_config_name(void)
{
const char *name;