Re: [PATCH v2 1/8] pack-objects: use standard option incompatibility functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Taylor Blau <me@xxxxxxxxxxxx> writes:

> pack-objects has a handful of explicit checks for pairs of command-line
> options which are mutually incompatible. Many of these pre-date
> a699367bb8 (i18n: factorize more 'incompatible options' messages,
> 2022-01-31).
>
> Convert the explicit checks into die_for_incompatible_opt2() calls,
> which simplifies the implementation and standardizes pack-objects'
> output when given incompatible options (e.g., --stdin-packs with
> --filter gives different output than --keep-unreachable with
> --unpack-unreachable).

Makes sense.

> -	if (stdin_packs && filter_options.choice)
> -		die(_("cannot use --filter with --stdin-packs"));
> +	die_for_incompatible_opt2(filter_options.choice, "--filter",
> +				  stdin_packs, "--stdin-packs");

The order of check is now reversed (which does not make any
difference to correctness or performance), but this way, we list the
options in the same order in the message as before, which is nice.

>  		test_must_fail git pack-objects --stdin-packs --stdout \
>  			--filter=blob:none </dev/null 2>err &&
> -		test_grep "cannot use --filter with --stdin-packs" err
> +		test_grep "options .--filter. and .--stdin-packs. cannot be used together" err
>  	)
>  '




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux