Re: [PATCH v4 6/6] config: add '--show-scope' to print the scope of a config value
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 24, 2020, 20:22 UTC
- Message-ID
- <xmqqblqszjs9.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <5549db7e39bf38aa5cc42292421f4676e3073b7d.1579825267.git.gitgitgadget@gmail.com>
"Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 19 quoted lines
> +const char *scope_to_string(enum config_scope scope)
> +{
> + switch (scope) {
> + case CONFIG_SCOPE_SYSTEM:
> + return "system";
> + case CONFIG_SCOPE_GLOBAL:
> + return "global";
> + case CONFIG_SCOPE_LOCAL:
> + return "local";
> + case CONFIG_SCOPE_WORKTREE:
> + return "worktree";
> + case CONFIG_SCOPE_COMMAND:
> + return "command";
> + case CONFIG_SCOPE_SUBMODULE:
> + return "submodule";
> + default:
> + return "unknown";
> + }
> +}In earlier round(s), this was called config_scope_name(), wasn't it?
"scope_to_string()" is a much worse than "config_scope_name()" as a name of a global function (e.g. we won't know what subsystems other than "config" may want to use "scope"). As you remember, Bert's "remote rename" series wants to use a public interface like this function, and the series expects this function to be called config_scope_name(). Let's not rename a public API function suddenly---it disrupts other topics in flight.
Thanks.