Thread (13 messages) flat view 13 messages, 3 authors, 2016-06-15
STALE3731d

[PATCH v3 08/10] config: Disallow multiple config file locations.

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:46:13
Subsystem: the rest · Maintainer: Linus Torvalds

Either --global, --system, or --file should be used, but not any
combination.

Signed-off-by: Felipe Contreras <redacted>
---
 builtin-config.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/builtin-config.c b/builtin-config.c
index 8ee0cd9..a674246 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -315,6 +315,11 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
 	argc = parse_options(argc, argv, builtin_config_options, builtin_config_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 
+	if (use_global_config + use_system_config + !!given_config_file > 1) {
+		error("only one config file at a time.");
+		usage_with_options(builtin_config_usage, builtin_config_options);
+	}
+
 	if (use_global_config) {
 		char *home = getenv("HOME");
 		if (home) {
-- 
1.6.1.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help