Subject: [PATCH v2 09/17] t5503: avoid discovering a bare repository

From: "Johannes Schindelin via GitGitGadget" <[email-masked]>
Date: Sat, 04 Apr 2026 19:49:49 +0000

From: Johannes Schindelin <[email-masked]>

The test case "fetch specific OID with tag following" creates a bare
repository and wants to operate on it by changing the working directory
and relying on Git's implicit discovery of the bare repository.

Once the `safe.bareRepository` default is changed, this is no longer
an option.

So let's adjust the commands to specify the bare repository explicitly,
via `--git-dir`, and avoid changing the working directory. As a bonus,
the result is arguably more readable than the original code.

Signed-off-by: Johannes Schindelin <[email-masked]>
---
 t/t5503-tagfollow.sh | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh
index febe441041..6d178d84dd 100755
--- a/t/t5503-tagfollow.sh
+++ b/t/t5503-tagfollow.sh
@@ -168,16 +168,13 @@ test_expect_success 'new clone fetch main and tags' '
 
 test_expect_success 'fetch specific OID with tag following' '
 	git init --bare clone3.git &&
-	(
-		cd clone3.git &&
-		git remote add origin .. &&
-		git fetch origin $B:refs/heads/main &&
+	git --git-dir=clone3.git remote add origin "$PWD" &&
+	git --git-dir=clone3.git fetch origin $B:refs/heads/main &&
 
-		git -C .. for-each-ref >expect &&
-		git for-each-ref >actual &&
+	git for-each-ref >expect &&
+	git --git-dir=clone3.git for-each-ref >actual &&
 
-		test_cmp expect actual
-	)
+	test_cmp expect actual
 '
 
 test_done
-- 
gitgitgadget