Skip to content

Commit 6766e41

Browse files
ROGERSM94gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6dc905d commit 6766e41

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

config.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ static int do_git_config_sequence(const struct config_options *opts,
17371737
free(path);
17381738
}
17391739

1740-
current_parsing_scope = CONFIG_SCOPE_CMDLINE;
1740+
current_parsing_scope = CONFIG_SCOPE_COMMAND;
17411741
if (!opts->ignore_cmdline && git_config_from_parameters(fn, data) < 0)
17421742
die(_("unable to parse command-line config"));
17431743

@@ -3305,8 +3305,8 @@ const char *config_scope_name(enum config_scope scope)
33053305
return "local";
33063306
case CONFIG_SCOPE_WORKTREE:
33073307
return "worktree";
3308-
case CONFIG_SCOPE_CMDLINE:
3309-
return "cmdline";
3308+
case CONFIG_SCOPE_COMMAND:
3309+
return "command";
33103310
default:
33113311
return "unknown";
33123312
}

config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ enum config_scope {
300300
CONFIG_SCOPE_GLOBAL,
301301
CONFIG_SCOPE_LOCAL,
302302
CONFIG_SCOPE_WORKTREE,
303-
CONFIG_SCOPE_CMDLINE,
303+
CONFIG_SCOPE_COMMAND,
304304
};
305305
const char *config_scope_name(enum config_scope scope);
306306

t/t1308-config-set.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ test_expect_success 'iteration shows correct origins' '
265265
value=from-cmdline
266266
origin=command line
267267
name=
268-
scope=cmdline
268+
scope=command
269269
EOF
270270
GIT_CONFIG_PARAMETERS=$cmdline_config test-tool config iterate >actual &&
271271
test_cmp expect actual

0 commit comments

Comments
 (0)