@@ -599,11 +599,20 @@ test_expect_success '#20b/c: core.worktree and core.bare conflict' '
599
599
mkdir -p 20b/.git/wt/sub &&
600
600
(
601
601
cd 20b/.git &&
602
- test_must_fail git symbolic-ref HEAD >/dev/null
602
+ test_must_fail git status >/dev/null
603
603
) 2>message &&
604
604
grep "core.bare and core.worktree" message
605
605
'
606
606
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
+
607
616
# Case #21: core.worktree/GIT_WORK_TREE overrides core.bare' '
608
617
test_expect_success ' #21: setup, core.worktree warns before overriding core.bare' '
609
618
setup_repo 21 non-existent "" unset &&
@@ -612,7 +621,7 @@ test_expect_success '#21: setup, core.worktree warns before overriding core.bare
612
621
cd 21/.git &&
613
622
GIT_WORK_TREE="$here/21" &&
614
623
export GIT_WORK_TREE &&
615
- git symbolic-ref HEAD >/dev/null
624
+ git status >/dev/null
616
625
) 2>message &&
617
626
! test -s message
618
627
@@ -701,13 +710,13 @@ test_expect_success '#22.2: core.worktree and core.bare conflict' '
701
710
cd 22/.git &&
702
711
GIT_DIR=. &&
703
712
export GIT_DIR &&
704
- test_must_fail git symbolic-ref HEAD 2>result
713
+ test_must_fail git status 2>result
705
714
) &&
706
715
(
707
716
cd 22 &&
708
717
GIT_DIR=.git &&
709
718
export GIT_DIR &&
710
- test_must_fail git symbolic-ref HEAD 2>result
719
+ test_must_fail git status 2>result
711
720
) &&
712
721
grep "core.bare and core.worktree" 22/.git/result &&
713
722
grep "core.bare and core.worktree" 22/result
@@ -753,9 +762,8 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '
753
762
setup_repo 28 "$here/28" gitfile true &&
754
763
(
755
764
cd 28 &&
756
- test_must_fail git symbolic-ref HEAD
765
+ test_must_fail git status
757
766
) 2>message &&
758
- ! grep "^warning:" message &&
759
767
grep "core.bare and core.worktree" message
760
768
'
761
769
@@ -767,7 +775,7 @@ test_expect_success '#29: setup' '
767
775
cd 29 &&
768
776
GIT_WORK_TREE="$here/29" &&
769
777
export GIT_WORK_TREE &&
770
- git symbolic-ref HEAD >/dev/null
778
+ git status
771
779
) 2>message &&
772
780
! test -s message
773
781
'
@@ -778,7 +786,7 @@ test_expect_success '#30: core.worktree and core.bare conflict (gitfile version)
778
786
setup_repo 30 "$here/30" gitfile true &&
779
787
(
780
788
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
782
790
) &&
783
791
grep "core.bare and core.worktree" 30/result
784
792
'
0 commit comments