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, 19:18 UTC
- Message-ID
- <xmqqsgk4zmrs.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <5549db7e39bf38aa5cc42292421f4676e3073b7d.1579825267.git.gitgitgadget@gmail.com>
"Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 9 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";Despite the screw-up at an earlier step, this one is correct ;-)
Show 11 quoted lines
> + case CONFIG_SCOPE_WORKTREE: > + return "worktree"; > + case CONFIG_SCOPE_COMMAND: > + return "command"; > + case CONFIG_SCOPE_SUBMODULE: > + return "submodule"; > + default: > + return "unknown"; > + } > +} > +
Show 20 quoted lines
> diff --git a/t/t1300-config.sh b/t/t1300-config.sh > index e5fb9114f6..79dbea9bd1 100755 > --- a/t/t1300-config.sh > +++ b/t/t1300-config.sh > @@ -1771,6 +1771,65 @@ test_expect_success '--show-origin blob ref' ' > test_cmp expect output > ' > > +test_expect_success '--show-scope with --list' ' > + cat >expect <<-EOF && > + global user.global=true > + global user.override=global > + global include.path=$INCLUDE_DIR/absolute.include > + global user.absolute=include > + local user.local=true > + local user.override=local > + local include.path=../include/relative.include > + local user.relative=include > + command user.cmdline=true > + EOF
We cleaned up the existing ones that are overly indented from this script in an earlier step. Let's not re-introduce them.