[PATCH v2 09/17] t5503: avoid discovering a bare repository
- From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Apr 4, 2026, 19:49 UTC
- Message-ID
- <9001883e152407464c83227f1e09664d0d8826b5.1775332197.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2076.v2.git.1775332197.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
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 <johannes.schindelin@gmx.de> --- 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