From: Bert Wesarg <bert.wesarg@googlemail.com>
To: git@vger.kernel.org
Cc: Bert Wesarg <bert.wesarg@googlemail.com>,
Matthew Rogers <mattr94@gmail.com>
Subject: [RFC PATCH 5/7] config: make `scope_name` global as `config_scope_name`
Date: Fri, 24 Jan 2020 10:25:25 +0100 [thread overview]
Message-ID: <00742e5cd2d5b44c256be3b14fd2dd07e306ffdf.1579857394.git.bert.wesarg@googlemail.com> (raw)
In-Reply-To: <cover.1579857394.git.bert.wesarg@googlemail.com>
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
Will be replaced by Matthew Rogers.
Cc: Matthew Rogers <mattr94@gmail.com>
---
config.c | 16 ++++++++++++++++
config.h | 1 +
t/helper/test-config.c | 17 +----------------
3 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/config.c b/config.c
index d75f88ca0c..4c461bb7a3 100644
--- a/config.c
+++ b/config.c
@@ -3317,6 +3317,22 @@ enum config_scope current_config_scope(void)
return current_parsing_scope;
}
+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";
+ }
+}
+
int lookup_config(const char **mapping, int nr_mapping, const char *var)
{
int i;
diff --git a/config.h b/config.h
index 91fd4c5e96..c063f33ff6 100644
--- a/config.h
+++ b/config.h
@@ -301,6 +301,7 @@ enum config_scope {
CONFIG_SCOPE_REPO,
CONFIG_SCOPE_CMDLINE,
};
+const char *config_scope_name(enum config_scope scope);
enum config_scope current_config_scope(void);
const char *current_config_origin_type(void);
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;
}
--
2.24.1.497.g9abd7b20b4.dirty
next prev parent reply other threads:[~2020-01-24 9:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 9:25 [PATCH v2 0/7] remote rename/remove: improve handling of configuration values Bert Wesarg
2020-01-24 9:25 ` [PATCH v2 1/7] pull --rebase/remote rename: document and honor single-letter abbreviations rebase types Bert Wesarg
2020-01-24 9:25 ` [PATCH v2 2/7] remote: clean-up by returning early to avoid one indentation Bert Wesarg
2020-01-24 9:25 ` [PATCH 3/7] remote: clean-up config callback Bert Wesarg
2020-01-24 9:25 ` [PATCH v4 4/7] remote rename/remove: handle branch.<name>.pushRemote config values Bert Wesarg
2020-01-25 0:46 ` Johannes Schindelin
2020-01-25 7:29 ` Bert Wesarg
2020-01-26 9:30 ` Johannes Schindelin
2020-01-24 9:25 ` Bert Wesarg [this message]
2020-01-24 9:25 ` [PATCH 6/7] config: provide access to the current line number Bert Wesarg
2020-01-24 9:25 ` [PATCH v2 7/7] remote rename/remove: gently handle remote.pushDefault config Bert Wesarg
2020-01-24 21:00 ` [PATCH v2 0/7] remote rename/remove: improve handling of configuration values Junio C Hamano
2020-01-25 0:39 ` Matt Rogers
2020-01-27 6:50 ` Bert Wesarg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00742e5cd2d5b44c256be3b14fd2dd07e306ffdf.1579857394.git.bert.wesarg@googlemail.com \
--to=bert.wesarg@googlemail.com \
--cc=git@vger.kernel.org \
--cc=mattr94@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).