Re: [PATCH v4 6/6] config: add '--show-scope' to print the scope of a config value
- From
Matt Rogers <mattr94@gmail.com>
- Date
- Jan 24, 2020, 20:49 UTC
- Message-ID
- <CAOjrSZsTZic1daj7zG1tZbgENUxt7XGU3mTJAC4_gdiybFMt0Q@mail.gmail.com>
- In-Reply-To
- <xmqqblqszjs9.fsf@gitster-ct.c.googlers.com>
I think this was a mess-up on my end. I had meant to rename it to config_scope_name() (after talking with Bert) but it appears that I had messed up, so I think my mistake wasn't to rename the function, but to fail to rename it. So I do apologize.
On Fri, Jan 24, 2020 at 3:22 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 34 quoted lines
>
> "Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > +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.-- Matthew Rogers