Skip to content

Commit 936ce91

Browse files
committed
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 1e406ba commit 936ce91

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

config.c

Lines changed: 1 addition & 1 deletion
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

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

306306
enum config_scope current_config_scope(void);

t/helper/test-config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ static const char *scope_name(enum config_scope scope)
4848
return "local";
4949
case CONFIG_SCOPE_WORKTREE:
5050
return "worktree";
51-
case CONFIG_SCOPE_CMDLINE:
52-
return "cmdline";
51+
case CONFIG_SCOPE_COMMAND:
52+
return "command";
5353
default:
5454
return "unknown";
5555
}

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)