Subject: Re: [PATCH v8 03/14] merge-index: libify merge_one_path() and merge_all()

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 17 Aug 2022 04:10:47 +0200

On Tue, Aug 09 2022, Alban Gruin wrote:

[Re-arranged]

Rather than changing this behavior:

> diff --git a/t/t7607-merge-state.sh b/t/t7607-merge-state.sh
> index 89a62ac53b..96befa5b80 100755
> --- a/t/t7607-merge-state.sh
> +++ b/t/t7607-merge-state.sh
> @@ -20,7 +20,7 @@ test_expect_success 'Ensure we restore original state if no merge strategy handl
>  	# just hit conflicts, it completely fails and says that it cannot
>  	# handle this type of merge.
>  	test_expect_code 2 git merge branch2 branch3 >output 2>&1 &&
> -	grep "fatal: merge program failed" output &&
> +	grep "error: merge program failed" output &&
>  	grep "Should not be doing an octopus" output &&

In this (or some of it?):

> [...]
>  	# Make sure we did not leave stray changes around when no appropriate
> [...]
> -	if (run_command_v_opt(arguments, 0)) {
> -		if (one_shot)
> -			err++;
> -		else {
> -			if (!quiet)
> -				die("merge program failed");
> -			exit(1);
> [...]
> +			if (!quiet && !oneshot)
> +				error(_("merge program failed"));
> +			return 1;
> [...]
> +		if (err && !oneshot) {
> +			if (!quiet)
> +				error(_("merge program failed"));
> +			return 1;
> +		}
> +	}
> +
> +	if (err && !quiet)
> +		error(_("merge program failed"));

Should we not be using die_message() here instead?