From ca053477d93d76791413418766c3ff24996ca528 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 2 Apr 2026 14:33:10 +0000 Subject: [PATCH] t0056: allow implicit bare repo discovery for `-C` work-tree tests The `git -C c/a.git --work-tree=../a` invocations in t0056-git-C.sh enter what is technically the `.git` directory of a repository to test `-C` combined with `--work-tree`. In doing so, the code relies on implicit discovery of bare repositories, which 8d1a7448206e (setup.c: create `safe.bareRepository`, 2022-07-14) prepared to be prevented by default. These tests verify the interaction between those flags, so changing them to use `--git-dir` would defeat their purpose. So let's just temporarily force-enable implicit discovery of bare repositories, no matter what `safe.bareRepository` defaults to. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t0056-git-C.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/t0056-git-C.sh b/t/t0056-git-C.sh index 2630e756da..6b7122add5 100755 --- a/t/t0056-git-C.sh +++ b/t/t0056-git-C.sh @@ -57,11 +57,13 @@ test_expect_success 'Order should not matter: "--git-dir=a.git -C c" is equivale test_expect_success 'Effect on --work-tree option: "-C c/a.git --work-tree=../a" is equivalent to "--work-tree=c/a --git-dir=c/a.git"' ' rm c/a/a.txt && git --git-dir=c/a.git --work-tree=c/a status >expected && + test_config_global safe.bareRepository all && git -C c/a.git --work-tree=../a status >actual && test_cmp expected actual ' test_expect_success 'Order should not matter: "--work-tree=../a -C c/a.git" is equivalent to "-C c/a.git --work-tree=../a"' ' + test_config_global safe.bareRepository all && git -C c/a.git --work-tree=../a status >expected && git --work-tree=../a -C c/a.git status >actual && test_cmp expected actual