]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: clarify meaning of command line scoping
authorMatthew Rogers <mattr94@gmail.com>
Mon, 10 Feb 2020 00:30:55 +0000 (00:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Feb 2020 18:39:02 +0000 (10:39 -0800)
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
config.h
t/t1308-config-set.sh

index f68eec766f544e719d5babf38418e58e35a42a05..fe1e44a43aa01f6c2c90f01b65ea306bf42e4547 100644 (file)
--- 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 "cmdline";
+       case CONFIG_SCOPE_COMMAND:
+               return "command";
        default:
                return "unknown";
        }
index 49297b507788008a9a03009d8085b336ff5df9e0..397ba4063cc008478189f9906a4c60ccfc93a7ff 100644 (file)
--- a/config.h
+++ b/config.h
@@ -300,7 +300,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);
 
index 90196e286222e20346351b1a0a0adb77ec9e673f..fba0abe429ace841f720cc8a41281bdf08943053 100755 (executable)
@@ -265,7 +265,7 @@ test_expect_success 'iteration shows correct origins' '
        value=from-cmdline
        origin=command line
        name=
-       scope=cmdline
+       scope=command
        EOF
        GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
        test_cmp expect actual