Subject: Re: [PATCH v6 1/9] pack-objects: use standard option incompatibility functions

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Jun 2025 08:52:59 -0700

Taylor Blau <[email-masked]> writes:

> @@ -5050,13 +5051,14 @@ int cmd_pack_objects(int argc,
>  	if (!pack_to_stdout && thin)
>  		die(_("--thin cannot be used to build an indexable pack"));
>  
> -	if (keep_unreachable && unpack_unreachable)
> -		die(_("options '%s' and '%s' cannot be used together"), "--keep-unreachable", "--unpack-unreachable");
> +	die_for_incompatible_opt2(keep_unreachable, "--keep-unreachable",
> +				  unpack_unreachable, "--unpack-unreachable");
>  	if (!rev_list_all || !rev_list_reflog || !rev_list_index)
>  		unpack_unreachable_expiration = 0;
>  
> -	if (stdin_packs && filter_options.choice)
> -		die(_("cannot use --filter with --stdin-packs"));
> +	die_for_incompatible_opt2(stdin_packs, "--stdin-packs",
> +				  filter_options.choice, "--filter");
> +
>  

We do not need two blank lines here, do we?

> @@ -5064,8 +5066,8 @@ int cmd_pack_objects(int argc,
>  	if (cruft) {
>  		if (use_internal_rev_list)
>  			die(_("cannot use internal rev list with --cruft"));
> -		if (stdin_packs)
> -			die(_("cannot use --stdin-packs with --cruft"));
> +		die_for_incompatible_opt2(stdin_packs, "--stdin-packs",
> +					  cruft, "--cruft");
>  	}
>  
>  	/*
> diff --git a/t/t5331-pack-objects-stdin.sh b/t/t5331-pack-objects-stdin.sh
> index b48c0cbe8f..8fd07deb8d 100755
> --- a/t/t5331-pack-objects-stdin.sh
> +++ b/t/t5331-pack-objects-stdin.sh
> @@ -64,7 +64,7 @@ test_expect_success '--stdin-packs is incompatible with --filter' '
>  		cd stdin-packs &&
>  		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 .--stdin-packs. and .--filter. cannot be used together" err

OK.