]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-config.c
git config: don't allow multiple config file locations
[thirdparty/git.git] / builtin-config.c
index 08a77cd7df4c834eb6cde85d3840713848e43e03..d037e4745c139b1491e5cd344ebf1f24cd8111c0 100644 (file)
@@ -316,6 +316,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) {