git config: don't allow multiple config file locations
Either --global, --system, or --file can be used, but not any combination. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Feb 21, 2009 at 02:49 UTC
67052c9dcfb3ab46b18e734ea4a9117eb61fea4e
1 file changed
+5
builtin-config.c
+5
@@ -316,6 +316,11 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
316
argc = parse_options(argc, argv, builtin_config_options, builtin_config_usage,
317
PARSE_OPT_STOP_AT_NON_OPTION);
318
319
+ if (use_global_config + use_system_config + !!given_config_file > 1) {
320
+ error("only one config file at a time.");
321
+ usage_with_options(builtin_config_usage, builtin_config_options);
322
+ }
323
+
324
if (use_global_config) {
325
char *home = getenv("HOME");
326
if (home) {