- try_case 20b/.git unset unset \
- . "(null)" "$here/20b/.git" "(null)" &&
- try_case 20b/.git/wt unset unset \
- "$here/20b/.git" "(null)" "$here/20b/.git/wt" "(null)" &&
- try_case 20b/.git/wt/sub unset unset \
- "$here/20b/.git" "(null)" "$here/20b/.git/wt/sub" "(null)" &&
- try_repo 20c unset unset non-existent "" true \
- .git "(null)" "$here/20c" "(null)" \
- "$here/20c/.git" "(null)" "$here/20c/sub" "(null)"
-'
-
-test_expect_success '#21: core.worktree+GIT_WORK_TREE without GIT_DIR ignored (bare cases)' '
- setup_repo 21a non-existent "" unset &&
- mkdir -p 21a/.git/wt/sub &&
- try_case 21a/.git non-existent-too unset \
- . "(null)" "$here/21a/.git" "(null)" &&
- try_case 21a/.git/wt non-existent-too unset \
- "$here/21a/.git" "(null)" "$here/21a/.git/wt" "(null)" &&
- try_case 21a/.git/wt/sub non-existent-too unset \
- "$here/21a/.git" "(null)" "$here/21a/.git/wt/sub" "(null)" &&
-
- setup_repo 21b non-existent "" true &&
- mkdir -p 21b/.git/wt/sub &&
- try_case 21b/.git non-existent-too unset \
- . "(null)" "$here/21b/.git" "(null)" &&
- try_case 21b/.git/wt non-existent-too unset \
- "$here/21b/.git" "(null)" "$here/21b/.git/wt" "(null)" &&
- try_case 21b/.git/wt/sub non-existent-too unset \
- "$here/21b/.git" "(null)" "$here/21b/.git/wt/sub" "(null)" &&
-
- try_repo 21c non-existent-too unset non-existent "" true \
- .git "(null)" "$here/21c" "(null)" \
- "$here/21c/.git" "(null)" "$here/21c/sub" "(null)"
+ (
+ cd 20b/.git &&
+ test_must_fail git symbolic-ref HEAD >/dev/null
+ ) 2>message &&
+ grep "core.bare and core.worktree" message
+'
+
+# Case #21: core.worktree/GIT_WORK_TREE overrides core.bare' '
+test_expect_success '#21: setup, core.worktree warns before overriding core.bare' '
+ setup_repo 21 non-existent "" unset &&
+ mkdir -p 21/.git/wt/sub &&
+ (
+ cd 21/.git &&
+ GIT_WORK_TREE="$here/21" &&
+ export GIT_WORK_TREE &&
+ git symbolic-ref HEAD >/dev/null
+ ) 2>message &&
+ ! test -s message
+