Subject: Re: [PATCH v4 2/2] index-pack: --fsck-objects to take an optional argument for fsck msgs

From: SZEDER Gábor <[email-masked]>
Date: Fri, 8 Mar 2024 23:24:39 +0100

On Thu, Feb 01, 2024 at 01:38:02AM +0000, John Cai via GitGitGadget wrote:
> diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
> index 496fffa0f8a..a58f91035d1 100755
> --- a/t/t5300-pack-object.sh
> +++ b/t/t5300-pack-object.sh
> @@ -441,8 +441,7 @@ test_expect_success 'index-pack with --strict' '
>  	)
>  '
>  
> -test_expect_success 'index-pack with --strict downgrading fsck msgs' '
> -	test_when_finished rm -rf strict &&
> +test_expect_success 'setup for --strict and --fsck-objects downgrading fsck msgs' '
>  	git init strict &&
>  	(
>  		cd strict &&
> @@ -457,12 +456,32 @@ test_expect_success 'index-pack with --strict downgrading fsck msgs' '
>  
>  		EOF
>  		git hash-object --literally -t commit -w --stdin <commit >commit_list &&
> -		PACK=$(git pack-objects test <commit_list) &&
> -		test_must_fail git index-pack --strict "test-$PACK.pack" &&
> -		git index-pack --strict="missingEmail=ignore" "test-$PACK.pack"
> +		git pack-objects test <commit_list >pack-name
>  	)
>  '
>  
> +test_with_bad_commit () {
> +	must_fail_arg="$1" &&
> +	must_pass_arg="$2" &&
> +	(
> +		cd strict &&
> +		test_expect_fail git index-pack "$must_fail_arg" "test-$(cat pack-name).pack"

There is no such command as 'test_expect_fail', resulting in:

  expecting success of 5300.34 'index-pack with --strict downgrading fsck msgs':
          test_with_bad_commit --strict --strict="missingEmail=ignore"

  + test_with_bad_commit --strict --strict=missingEmail=ignore
  + must_fail_arg=--strict
  + must_pass_arg=--strict=missingEmail=ignore
  + cd strict
  + cat pack-name
  + test_expect_fail git index-pack --strict test-e4e1649155bf444fbd9cd85e376628d6eaf3d3bd.pack
  ./t5300-pack-object.sh: 468: eval: test_expect_fail: not found
  + cat pack-name
  + git index-pack --strict=missingEmail=ignore test-e4e1649155bf444fbd9cd85e376628d6eaf3d3bd.pack
  e4e1649155bf444fbd9cd85e376628d6eaf3d3bd

  ok 34 - index-pack with --strict downgrading fsck msgs

The missing command should fail the test, but it doesn't, because the
&&-chain is broken on this line as well.