Re: [PATCH v7 06/10] config: clarify meaning of command line scoping
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 10, 2020, 18:10 UTC
- Message-ID
- <xmqq4kvy1fgj.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <64c20d0556e9e72663940da7f58a8e55a75fa9d0.1581294660.git.gitgitgadget@gmail.com>
"Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 18 quoted lines
> From: Matthew Rogers <mattr94@gmail.com> > > CONFIG_SCOPE_CMDLINE is generally used in the code to refer to config > values passed in via the -c option. Options passed in using this > mechanism share similar scoping characteristics with the --file and > --blob options of the 'config' command, namely that they are only in use > for that single invocation of git, and that they supersede the normal > system/global/local hierarchy. This patch introduces > CONFIG_SCOPE_COMMAND to reflect this new idea, which also makes > CONFIG_SCOPE_CMDLINE redundant. > > Signed-off-by: Matthew Rogers <mattr94@gmail.com> > Signed-off-by: Junio C Hamano <gitster@pobox.com> > --- > config.c | 6 +++--- > config.h | 2 +- > t/t1308-config-set.sh | 2 +- > 3 files changed, 5 insertions(+), 5 deletions(-)
This makes sense, even though it is halfway undoing what 04/10 unnecessarily did ;-)
I think I can just wiggle minor fixes in to 04/10 and then adjust this one to get the series into a better shape myself before queuing them to expedite the process. Let me finish reading the remainder of the topic.
Thanks.
Show 50 quoted lines
> diff --git a/config.c b/config.c
> index 7422bdebb1..fe1e44a43a 100644
> --- a/config.c
> +++ b/config.c
> @@ -1737,7 +1737,7 @@ static int do_git_config_sequence(const struct config_options *opts,
> free(path);
> }
>
> - current_parsing_scope = CONFIG_SCOPE_CMDLINE;
> + current_parsing_scope = CONFIG_SCOPE_COMMAND;
> if (!opts->ignore_cmdline && git_config_from_parameters(fn, data) < 0)
> die(_("unable to parse command-line config"));
>
> @@ -3305,8 +3305,8 @@ const char *config_scope_name(enum config_scope scope)
> return "local";
> case CONFIG_SCOPE_WORKTREE:
> return "worktree";
> - case CONFIG_SCOPE_CMDLINE:
> - return "command line";
> + case CONFIG_SCOPE_COMMAND:
> + return "command";
> default:
> return "unknown";
> }
> diff --git a/config.h b/config.h
> index d3ed41ef8e..b570f4ce43 100644
> --- a/config.h
> +++ b/config.h
> @@ -301,7 +301,7 @@ enum config_scope {
> CONFIG_SCOPE_GLOBAL,
> CONFIG_SCOPE_LOCAL,
> CONFIG_SCOPE_WORKTREE,
> - CONFIG_SCOPE_CMDLINE,
> + CONFIG_SCOPE_COMMAND,
> };
> const char *config_scope_name(enum config_scope scope);
>
> diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
> index 728a2b87ce..fba0abe429 100755
> --- a/t/t1308-config-set.sh
> +++ b/t/t1308-config-set.sh
> @@ -265,7 +265,7 @@ test_expect_success 'iteration shows correct origins' '
> value=from-cmdline
> origin=command line
> name=
> - scope=command line
> + scope=command
> EOF
> GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
> test_cmp expect actual