Thread (1 message) 1 message, 1 author, 2020-01-24

Re: [PATCH v4 6/6] config: add '--show-scope' to print the scope of a config value

From: Junio C Hamano <hidden>
Date: 2020-01-24 19:18:20

"Matthew Rogers via GitGitGadget" [off-list ref] writes:
+const char *scope_to_string(enum config_scope scope)
+{
+	switch (scope) {
+	case CONFIG_SCOPE_SYSTEM:
+		return "system";
+	case CONFIG_SCOPE_GLOBAL:
+		return "global";
+	case CONFIG_SCOPE_LOCAL:
+		return "local";
Despite the screw-up at an earlier step, this one is correct ;-)
+	case CONFIG_SCOPE_WORKTREE:
+		return "worktree";
+	case CONFIG_SCOPE_COMMAND:
+		return "command";
+	case CONFIG_SCOPE_SUBMODULE:
+		return "submodule";
+	default:
+		return "unknown";
+	}
+}
+
quoted hunk
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index e5fb9114f6..79dbea9bd1 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -1771,6 +1771,65 @@ test_expect_success '--show-origin blob ref' '
 	test_cmp expect output
 '
 
+test_expect_success '--show-scope with --list' '
+	cat >expect <<-EOF &&
+		global	user.global=true
+		global	user.override=global
+		global	include.path=$INCLUDE_DIR/absolute.include
+		global	user.absolute=include
+		local	user.local=true
+		local	user.override=local
+		local	include.path=../include/relative.include
+		local	user.relative=include
+		command	user.cmdline=true
+	EOF
We cleaned up the existing ones that are overly indented from this
script in an earlier step.  Let's not re-introduce them.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help