summaryrefslogtreecommitdiff
path: root/t/helper/test-config.c
diff options
context:
space:
mode:
authorLibravatar Matthew Rogers <mattr94@gmail.com>2020-02-10 00:30:53 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-02-10 10:32:18 -0800
commita5cb4204b63b57e99ae3a44f23a7945f146fe078 (patch)
treee4e539ced905a7164614d498efe6b41d7ee3bf9c /t/helper/test-config.c
parentt1300: create custom config file without special characters (diff)
downloadtgif-a5cb4204b63b57e99ae3a44f23a7945f146fe078.tar.xz
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 't/helper/test-config.c')
-rw-r--r--t/helper/test-config.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/t/helper/test-config.c b/t/helper/test-config.c
index 214003d5b2..1e3bc7c8f4 100644
--- a/t/helper/test-config.c
+++ b/t/helper/test-config.c
@@ -37,21 +37,6 @@
*
*/
-static const char *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";
- }
-}
static int iterate_cb(const char *var, const char *value, void *data)
{
static int nr;
@@ -63,7 +48,7 @@ static int iterate_cb(const char *var, const char *value, void *data)
printf("value=%s\n", value ? value : "(null)");
printf("origin=%s\n", current_config_origin_type());
printf("name=%s\n", current_config_name());
- printf("scope=%s\n", scope_name(current_config_scope()));
+ printf("scope=%s\n", config_scope_name(current_config_scope()));
return 0;
}