Subject: Re: ab/fsck-unexpected-type (and "cat-file replace handling and optimization")

From: Junio C Hamano <[email-masked]>
Date: Thu, 07 Oct 2021 14:37:02 -0700

Jeff King <[email-masked]> writes:

> I don't mind rebasing on top if that's easier for Junio, but in that
> case it may make sense to float the test cleanup to the front of the
> series.

Yeah, I would rather not to see such a rebase (and I hate the kind
of churns we seem to be allowing more and more in our codebase that
causes needless textual conflicts.  We should really slow down and
make fewer pointless "clean-up" that disrupts real work).

> diff --cc t/t1006-cat-file.sh
> index a5e7401af8,4a753705ec..0000000000
> --- a/t/t1006-cat-file.sh
> +++ b/t/t1006-cat-file.sh
> @@@ -475,9 -332,18 +475,13 @@@ test_expect_success "Size of broken obj
>   	test_cmp expect actual
>   '
>   
> + test_expect_success 'clean up broken object' '
>  -	rm .git/objects/$(test_oid_to_path $bogus_sha1)
> ++	rm .git/objects/$(test_oid_to_path $bogus_short_sha1)
> + '
> + 
>  -bogus_type="abcdefghijklmnopqrstuvwxyz1234679"
>  -bogus_content="bogus"
>  -bogus_size=$(strlen "$bogus_content")
>  -bogus_sha1=$(echo_without_newline "$bogus_content" | git hash-object -t $bogus_type --literally -w --stdin)
>  -
>   test_expect_success "Type of broken object is correct when type is large" '
>  -	echo $bogus_type >expect &&
>  -	git cat-file -t --allow-unknown-type $bogus_sha1 >actual &&
>  +	echo $bogus_long_type >expect &&
>  +	git cat-file -t --allow-unknown-type $bogus_long_sha1 >actual &&
>   	test_cmp expect actual
>   '

These look sensible, but ...

> - test_expect_success 'cat-file -t and -s on corrupt loose object' '
> - 	git init --bare corrupt-loose.git &&
> - 	(
> - 		cd corrupt-loose.git &&
> ...
> - 		test_must_fail git fsck 2>err.fsck &&
> - 		grep "^error: inflate: data stream error (" err.fsck
> - 	)

... what's this lossage of the whole new test?

> + test_expect_success 'clean up broken object' '
>  -	rm .git/objects/$(test_oid_to_path $bogus_sha1)
> ++	rm .git/objects/$(test_oid_to_path $bogus_long_sha1)
>   '

Again, this one makes sense.

Thanks.