@@ -598,11 +598,20 @@ test_expect_success '#20b/c: core.worktree and core.bare conflict' '
598598 mkdir -p 20b/.git/wt/sub &&
599599 (
600600 cd 20b/.git &&
601- test_must_fail git symbolic-ref HEAD >/dev/null
601+ test_must_fail git status >/dev/null
602602 ) 2>message &&
603603 grep "core.bare and core.worktree" message
604604'
605605
606+ test_expect_success ' #20d: core.worktree and core.bare OK when working tree not needed' '
607+ setup_repo 20d non-existent "" true &&
608+ mkdir -p 20d/.git/wt/sub &&
609+ (
610+ cd 20d/.git &&
611+ git config foo.bar value
612+ )
613+ '
614+
606615# Case #21: core.worktree/GIT_WORK_TREE overrides core.bare' '
607616test_expect_success ' #21: setup, core.worktree warns before overriding core.bare' '
608617 setup_repo 21 non-existent "" unset &&
@@ -611,7 +620,7 @@ test_expect_success '#21: setup, core.worktree warns before overriding core.bare
611620 cd 21/.git &&
612621 GIT_WORK_TREE="$here/21" &&
613622 export GIT_WORK_TREE &&
614- git symbolic-ref HEAD >/dev/null
623+ git status >/dev/null
615624 ) 2>message &&
616625 ! test -s message
617626
@@ -700,13 +709,13 @@ test_expect_success '#22.2: core.worktree and core.bare conflict' '
700709 cd 22/.git &&
701710 GIT_DIR=. &&
702711 export GIT_DIR &&
703- test_must_fail git symbolic-ref HEAD 2>result
712+ test_must_fail git status 2>result
704713 ) &&
705714 (
706715 cd 22 &&
707716 GIT_DIR=.git &&
708717 export GIT_DIR &&
709- test_must_fail git symbolic-ref HEAD 2>result
718+ test_must_fail git status 2>result
710719 ) &&
711720 grep "core.bare and core.worktree" 22/.git/result &&
712721 grep "core.bare and core.worktree" 22/result
@@ -752,9 +761,8 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '
752761 setup_repo 28 "$here/28" gitfile true &&
753762 (
754763 cd 28 &&
755- test_must_fail git symbolic-ref HEAD
764+ test_must_fail git status
756765 ) 2>message &&
757- ! grep "^warning:" message &&
758766 grep "core.bare and core.worktree" message
759767'
760768
@@ -766,7 +774,7 @@ test_expect_success '#29: setup' '
766774 cd 29 &&
767775 GIT_WORK_TREE="$here/29" &&
768776 export GIT_WORK_TREE &&
769- git symbolic-ref HEAD >/dev/null
777+ git status
770778 ) 2>message &&
771779 ! test -s message
772780'
@@ -777,7 +785,7 @@ test_expect_success '#30: core.worktree and core.bare conflict (gitfile version)
777785 setup_repo 30 "$here/30" gitfile true &&
778786 (
779787 cd 30 &&
780- test_must_fail env GIT_DIR=.git git symbolic-ref HEAD 2>result
788+ test_must_fail env GIT_DIR=.git git status 2>result
781789 ) &&
782790 grep "core.bare and core.worktree" 30/result
783791'
0 commit comments