summaryrefslogtreecommitdiff
path: root/builtin-config.c
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2009-02-21 02:49:26 +0200
committerJunio C Hamano <gitster@pobox.com>2009-02-21 20:37:44 -0800
commit67052c9dcfb3ab46b18e734ea4a9117eb61fea4e (patch)
tree5fe0ff4f4c9a177e59aa1ab693fd13678fdfca20 /builtin-config.c
parentd64ec16c2af4ddcf3985d11d5dc28a15db181de5 (diff)
downloadgit-67052c9dcfb3ab46b18e734ea4a9117eb61fea4e.tar.gz
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>
Diffstat (limited to 'builtin-config.c')
-rw-r--r--builtin-config.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin-config.c b/builtin-config.c
index 08a77cd7df..d037e4745c 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -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) {