Subject: Re: [PATCH 2/2] refs: allow skipping OID verification

From: Junio C Hamano <[email-masked]>
Date: Thu, 25 Nov 2021 23:32:03 -0800

"Han-Wen Nienhuys via GitGitGadget" <[email-masked]> writes:

> From: Han-Wen Nienhuys <[email-masked]>
>
> This introduces the REF_SKIP_OID_VERIFICATION flag, which lets the ref-store
> test helper write non-existent or unparsable objects into the ref storage.

Yay.

> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
> index 658628375c8..f5333196b07 100755
> --- a/t/t1006-cat-file.sh
> +++ b/t/t1006-cat-file.sh
> @@ -452,9 +452,8 @@ test_expect_success 'the --allow-unknown-type option does not consider replaceme
>  	# Create it manually, as "git replace" will die on bogus
>  	# types.
>  	head=$(git rev-parse --verify HEAD) &&
> -	test_when_finished "rm -rf .git/refs/replace" &&
> -	mkdir -p .git/refs/replace &&
> -	echo $head >.git/refs/replace/$bogus_short_sha1 &&
> +	test_when_finished "test-tool ref-store main delete-refs 0 msg refs/replace/$bogus_short_sha1" &&
> +	test-tool ref-store main update-ref msg "refs/replace/$bogus_short_sha1" $head $ZERO_OID 1024 &&

Double yay.  Tests that are independent of backend is indeed much nicer.