@@ -599,11 +599,20 @@ test_expect_success '#20b/c: core.worktree and core.bare conflict' '
599599 mkdir -p 20b/.git/wt/sub &&
600600 (
601601 cd 20b/.git &&
602- test_must_fail git symbolic-ref HEAD >/dev/null
602+ test_must_fail git status >/dev/null
603603 ) 2>message &&
604604 grep "core.bare and core.worktree" message
605605'
606606
607+ test_expect_success ' #20d: core.worktree and core.bare OK when working tree not needed' '
608+ setup_repo 20d non-existent "" true &&
609+ mkdir -p 20d/.git/wt/sub &&
610+ (
611+ cd 20d/.git &&
612+ git config foo.bar value
613+ )
614+ '
615+
607616# Case #21: core.worktree/GIT_WORK_TREE overrides core.bare' '
608617test_expect_success ' #21: setup, core.worktree warns before overriding core.bare' '
609618 setup_repo 21 non-existent "" unset &&
@@ -612,7 +621,7 @@ test_expect_success '#21: setup, core.worktree warns before overriding core.bare
612621 cd 21/.git &&
613622 GIT_WORK_TREE="$here/21" &&
614623 export GIT_WORK_TREE &&
615- git symbolic-ref HEAD >/dev/null
624+ git status >/dev/null
616625 ) 2>message &&
617626 ! test -s message
618627
@@ -701,13 +710,13 @@ test_expect_success '#22.2: core.worktree and core.bare conflict' '
701710 cd 22/.git &&
702711 GIT_DIR=. &&
703712 export GIT_DIR &&
704- test_must_fail git symbolic-ref HEAD 2>result
713+ test_must_fail git status 2>result
705714 ) &&
706715 (
707716 cd 22 &&
708717 GIT_DIR=.git &&
709718 export GIT_DIR &&
710- test_must_fail git symbolic-ref HEAD 2>result
719+ test_must_fail git status 2>result
711720 ) &&
712721 grep "core.bare and core.worktree" 22/.git/result &&
713722 grep "core.bare and core.worktree" 22/result
@@ -753,9 +762,8 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '
753762 setup_repo 28 "$here/28" gitfile true &&
754763 (
755764 cd 28 &&
756- test_must_fail git symbolic-ref HEAD
765+ test_must_fail git status
757766 ) 2>message &&
758- ! grep "^warning:" message &&
759767 grep "core.bare and core.worktree" message
760768'
761769
@@ -767,7 +775,7 @@ test_expect_success '#29: setup' '
767775 cd 29 &&
768776 GIT_WORK_TREE="$here/29" &&
769777 export GIT_WORK_TREE &&
770- git symbolic-ref HEAD >/dev/null
778+ git status
771779 ) 2>message &&
772780 ! test -s message
773781'
@@ -778,7 +786,7 @@ test_expect_success '#30: core.worktree and core.bare conflict (gitfile version)
778786 setup_repo 30 "$here/30" gitfile true &&
779787 (
780788 cd 30 &&
781- test_must_fail env GIT_DIR=.git git symbolic-ref HEAD 2>result
789+ test_must_fail env GIT_DIR=.git git status 2>result
782790 ) &&
783791 grep "core.bare and core.worktree" 30/result
784792'
0 commit comments