Subject: Re: [PATCH v6 6/6] refs: add GIT_REFERENCE_BACKEND to specify reference backend

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 17 Feb 2026 11:15:44 +0100

On Tue, Feb 17, 2026 at 03:32:56AM -0600, Karthik Nayak wrote:
> Patrick Steinhardt <[email-masked]> writes:
> >> diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh
> >> index 9912433b8c..b743c03a59 100755
> >> --- a/t/t1423-ref-backend.sh
> >> +++ b/t/t1423-ref-backend.sh
> > [snip]
> >> +test_expect_success 'initializing repository with alt ref directory' '
> >> +	test_when_finished "rm -rf repo refdir" &&
> >> +	mkdir refdir &&
> >> +	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
> >> +	GIT_REFERENCE_BACKEND=$BACKEND git init repo &&
> >> +	(
> >> +		cd repo &&
> >> +
> >> +		git config get extensions.refstorage >expect &&
> >> +		echo $BACKEND >actual &&
> >> +		test_cmp expect actual &&
> >> +
> >> +		test_commit 1 &&
> >> +		test_commit 2 &&
> >> +		test_commit 3 &&
> >> +		git refs list >out &&
> >> +		test_grep "refs/tags/1"	out &&
> >> +		test_grep "refs/tags/2"	out &&
> >> +		test_grep "refs/tags/3"	out
> >> +	)
> >> +'
> >
> > Should we also verify that the refdir contains the data and that the
> > repository only contains stubs?
> >
> >> +test_expect_success 'cloning repository with alt ref directory' '
> >> +	test_when_finished "rm -rf source repo refdir" &&
> >> +	mkdir refdir &&
> >> +
> >> +	git init source &&
> >> +	test_commit -C source 1 &&
> >> +	test_commit -C source 2 &&
> >> +	test_commit -C source 3 &&
> >> +
> >> +	BACKEND="$(test_detect_ref_format)://$(pwd)/refdir" &&
> >> +	GIT_REFERENCE_BACKEND=$BACKEND git clone source repo &&
> >> +
> >> +	git -C repo config get extensions.refstorage >expect &&
> >> +	echo $BACKEND >actual &&
> >> +	test_cmp expect actual &&
> >> +
> >> +	git -C source for-each-ref refs/tags/ >expect &&
> >> +	git -C repo for-each-ref refs/tags/ >actual &&
> >> +	test_cmp expect actual
> >> +'
> >> +
> >
> > Same question here.
> >
> > Thanks!
> >
> > Patrick
> 
> We can verify that the repository only contains stubs, but to verify
> that the refdir contains the data, we'd have to add backend specific
> logic, I'm not sure that is the way to go.

I mean all of this very much is backend-specific, but I think that it's
sensible to at least verify some of the basics here. Otherwise it might
silently do the wrong thing, and we'd never notice because we haven't
been testing for it.

Patrick