Re: [PATCH 5/8] config: Disallow multiple config file locations.
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 15, 2009, 12:26 UTC
- Message-ID
- <alpine.DEB.1.00.0902151324530.10279@pacific.mpi-cbg.de>
- In-Reply-To
- <1234688460-9248-5-git-send-email-felipe.contreras@gmail.com>
Hi,
On Sun, 15 Feb 2009, Felipe Contreras wrote:
Show 25 quoted lines
> Either --global, --system, or --file should be used, but not any
> combination.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
> builtin-config.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/builtin-config.c b/builtin-config.c
> index 83f8b74..e744ad8 100644
> --- a/builtin-config.c
> +++ b/builtin-config.c
> @@ -314,6 +314,16 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
>
> argc = parse_options(argc, argv, builtin_config_options, builtin_config_usage, 0);
>
> + {
> + int config_file_count = use_global_config + use_system_config;
> + if (given_config_file)
> + config_file_count++;
> + if (config_file_count > 1) {
> + error("only one config file at a time.");
> + usage_with_options(builtin_config_usage, builtin_config_options);
> + }
> + }Hmm. Is this a convoluted way to write
if (use_global_config + use_system_config + !!given_config_file > 1)
or am I misunderstanding anything?
Ciao, Dscho