Thread (1 message) 1 message, 1 author, 2020-02-10

Re: [PATCH v7 06/10] config: clarify meaning of command line scoping

From: Junio C Hamano <hidden>
Date: 2020-02-10 18:10:16

"Matthew Rogers via GitGitGadget" [off-list ref] writes:
From: Matthew Rogers <redacted>

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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 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.
quoted hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help