From: Karthik Nayak Date: Wed, 25 Feb 2026 09:41:06 GMT Subject: Re: [PATCH v8 6/6] refs: add GIT_REFERENCE_BACKEND to specify reference backend Message-ID: In-Reply-To: <874in5nr5p.fsf@iotcl.com> Toon Claes writes: > Karthik Nayak writes: > >> diff --git a/t/t1423-ref-backend.sh b/t/t1423-ref-backend.sh >> index 9912433b8c..1a7b8eadba 100755 >> --- a/t/t1423-ref-backend.sh >> +++ b/t/t1423-ref-backend.sh >> @@ -138,22 +189,92 @@ do >> git refs migrate --dry-run --ref-format=$to_format >out && >> BACKEND_PATH="$dir/$(sed "s/.* ${SQ}.git\/\(.*\)${SQ}/\1/" out)" && >> >> - git config set core.repositoryformatversion 1 && >> - git config set extensions.refStorage "$to_format://$BACKEND_PATH" && >> - >> - git worktree add ../wt 2 >> - ) && >> + run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \ >> + "worktree add ../wt 2" "$method" && >> >> - git -C repo for-each-ref --include-root-refs >expect && >> - git -C wt for-each-ref --include-root-refs >expect && >> - ! test_cmp expect actual && >> + run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \ >> + "for-each-ref --include-root-refs" "$method" >actual && >> + run_with_uri ../wt "$from_format" "$to_format://$BACKEND_PATH" \ >> + "for-each-ref --include-root-refs" "$method" >expect && >> + ! test_cmp expect actual && >> >> - git -C wt rev-parse 2 >expect && >> - git -C wt rev-parse HEAD >actual && >> - test_cmp expect actual >> + run_with_uri . "$from_format" "$to_format://$BACKEND_PATH" \ >> + "rev-parse 2" "$method" >actual && >> + run_with_uri ../wt "$from_format" "$to_format://$BACKEND_PATH" \ >> + "rev-parse HEAD" "$method" >expect && >> + test_cmp expect actual >> + ) >> ' >> done # closes dir >> + >> + test_expect_success "migrating repository to $to_format with alternate refs directory" ' >> + test_when_finished "rm -rf repo refdir" && >> + mkdir refdir && >> + GIT_REFERENCE_BACKEND="${from_format}://$(pwd)/refdir" git init repo && >> + ( >> + cd repo && >> + >> + test_commit 1 && >> + test_commit 2 && >> + test_commit 3 && >> + >> + git refs migrate --ref-format=$to_format && >> + git refs list >out && >> + test_grep "refs/tags/1" out && >> + test_grep "refs/tags/2" out && >> + test_grep "refs/tags/3" out >> + ) >> + ' >> + >> done # closes to_format >> done # closes from_format >> >> +done # closes method >> + >> +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 && >> + verify_files_exist repo/.git refdir && >> + ( >> + cd repo && >> + >> + git config get extensions.refstorage >expect && >> + echo $BACKEND >actual && > > Shouldn't these two be swapped, like: > > git config get extensions.refstorage >actual && > echo $BACKEND >expect && > >> + 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 >> + ) >> +' >> + >> +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 && > > Same here. > Makes sense. Will amend.