From: Nguyễn Thái Ngọc Duy Date: Fri, 26 Nov 2010 15:32:21 +0000 (+0700) Subject: t1510: setup case #22 X-Git-Tag: v1.7.4-rc0~4^2~22 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fd4e1888ae16978ce687de25409ee36eb11138ad;p=git.git t1510: setup case #22 Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh index 1d01a6c8e..1720fe25e 100755 --- a/t/t1510-repo-setup.sh +++ b/t/t1510-repo-setup.sh @@ -3084,4 +3084,341 @@ EOF test_repo 21/sub ' +# +# case #22.1 +# +############################################################ +# +# Input: +# +# - GIT_WORK_TREE is not set +# - GIT_DIR is set +# - core.worktree is set +# - .git is a directory +# - cwd is inside .git +# +# Output: +# +# bare attribute is ignored +# +# - worktree is at core.worktree +# - cwd is at worktree root +# - prefix is calculated +# - git_dir is at $GIT_DIR +# - cwd can be outside worktree + +test_expect_success '#22.1: setup' ' + unset GIT_DIR GIT_WORK_TREE && + mkdir 22 && + cd 22 && + git init && + mkdir .git/sub .git/wt .git/wt/sub && + cd .. +' + +test_expect_success '#22.1: GIT_DIR(rel), core.worktree=. at .git' ' + cat >22/.git/expected <22/.git/expected <22/.git/expected <22/.git/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/expected <22/.git/expected <22/.git/expected <22/.git/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/expected <22/.git/expected <22/.git/expected <22/.git/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/sub/expected <22/.git/sub/expected <result && + grep "core.bare and core.worktree do not make sense" result + ) +' + +test_expect_failure '#22.2: at root' ' + ( + cd 22 && + GIT_DIR=.git && + export GIT_DIR && + test_must_fail git symbolic-ref HEAD 2>result && + grep "core.bare and core.worktree do not make sense" result + ) +' + test_done