Subject: Re: [PATCH 6/9] t4013: add tests for log.diffMerges config

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 08 Apr 2021 01:06:26 +0200

On Thu, Apr 08 2021, Sergey Organov wrote:

> Test that wrong values are denied.
>
> Test that the value of log.diffMerges properly affects both
> --diff-merges=def and -m.
>
> Signed-off-by: Sergey Organov <[email-masked]>
> ---
>  t/t4013-diff-various.sh | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>
> diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
> index 275a6790896d..ee4afca06ced 100755
> --- a/t/t4013-diff-various.sh
> +++ b/t/t4013-diff-various.sh
> @@ -460,6 +460,32 @@ test_expect_success 'log --diff-merges=def matches --diff-merges=separate' '
>  	test_cmp expected actual
>  '
>  
> +test_expect_success 'deny wrong log.diffMerges config' '
> +	git config log.diffMerges wrong-value &&
> +	test_expect_code 128 git log &&
> +	git config --unset log.diffMerges

Don't use "git config", but "test_config" at the start, then you don't
need the --unset at the end, it'll happen automatically. Ditto for the
following tests.

> +'
> +
> +test_expect_success 'git config log.diffMerges first-parent' '
> +	git log -p --diff-merges=first-parent master >result &&
> +	process_diffs result >expected &&
> +	git config log.diffMerges first-parent &&
> +	git log -p --diff-merges=def master >result &&
> +	process_diffs result >actual &&
> +	git config --unset log.diffMerges &&
> +	test_cmp expected actual
> +'
> +
> +test_expect_success 'git config log.diffMerges first-parent vs -m' '
> +	git log -p --diff-merges=first-parent master >result &&
> +	process_diffs result >expected &&
> +	git config log.diffMerges first-parent &&
> +	git log -p -m master >result &&
> +	process_diffs result >actual &&
> +	git config --unset log.diffMerges &&
> +	test_cmp expected actual
> +'
> +
>  test_expect_success 'log -S requires an argument' '
>  	test_must_fail git log -S
>  '