@matheusbsbs / matheus-bagliano / commits / 6766e41b8a
Fork 0

config: clarify meaning of command line scoping

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>

Matthew Rogers committed Feb 10, 2020 at 00:30 UTC 6766e41b8aae21927625adbb8cdc87804153639a
3 files changed +5 -5
config.c
+3 -3
@@ -1737,7 +1737,7 @@ static int do_git_config_sequence(const struct config_options *opts,
1737 free(path);
1738 }
1739
1740 - current_parsing_scope = CONFIG_SCOPE_CMDLINE;
1740 + current_parsing_scope = CONFIG_SCOPE_COMMAND;
1741 if (!opts->ignore_cmdline && git_config_from_parameters(fn, data) < 0)
1742 die(_("unable to parse command-line config"));
1743
@@ -3305,8 +3305,8 @@ const char *config_scope_name(enum config_scope scope)
3305 return "local";
3306 case CONFIG_SCOPE_WORKTREE:
3307 return "worktree";
3308 - case CONFIG_SCOPE_CMDLINE:
3309 - return "cmdline";
3308 + case CONFIG_SCOPE_COMMAND:
3309 + return "command";
3310 default:
3311 return "unknown";
3312 }
config.h
+1 -1
@@ -300,7 +300,7 @@ enum config_scope {
300 CONFIG_SCOPE_GLOBAL,
301 CONFIG_SCOPE_LOCAL,
302 CONFIG_SCOPE_WORKTREE,
303 - CONFIG_SCOPE_CMDLINE,
303 + CONFIG_SCOPE_COMMAND,
304 };
305 const char *config_scope_name(enum config_scope scope);
306
t/t1308-config-set.sh
+1 -1
@@ -265,7 +265,7 @@ test_expect_success 'iteration shows correct origins' '
265 value=from-cmdline
266 origin=command line
267 name=
268 - scope=cmdline
268 + scope=command
269 EOF
270 GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
271 test_cmp expect actual