summaryrefslogtreecommitdiff
path: root/t/t1510-repo-setup.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-11-26 15:32:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-29 21:25:54 (GMT)
commit3f388c173092c7e0a214f2bafce8bac6e94951f9 (patch)
tree436221bae5f8f8e2c1ee8d21ce871658e8fbeb09 /t/t1510-repo-setup.sh
parent351fa1dc9fac3fc88895f30e6ef59e09ceb68bef (diff)
downloadgit-3f388c173092c7e0a214f2bafce8bac6e94951f9.zip
git-3f388c173092c7e0a214f2bafce8bac6e94951f9.tar.gz
git-3f388c173092c7e0a214f2bafce8bac6e94951f9.tar.bz2
t1510: setup case #5
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1510-repo-setup.sh')
-rwxr-xr-xt/t1510-repo-setup.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 1b4070a..f58d424 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -532,4 +532,52 @@ EOF
test_repo 4/sub
'
+#
+# case #5
+#
+############################################################
+#
+# Input:
+#
+# - GIT_WORK_TREE is set
+# - GIT_DIR is not set
+# - core.worktree is set
+# - .git is a directory
+# - core.bare is not set, cwd is outside .git
+#
+# Output:
+#
+# GIT_WORK_TREE/core.worktree are ignored -> #0
+
+test_expect_success '#5: setup' '
+ unset GIT_DIR GIT_WORK_TREE &&
+ mkdir 5 5/sub &&
+ cd 5 &&
+ git init &&
+ git config core.worktree non-existent &&
+ GIT_WORK_TREE=non-existent-too &&
+ export GIT_WORK_TREE &&
+ cd ..
+'
+
+test_expect_failure '#5: at root' '
+ cat >5/expected <<EOF &&
+setup: git_dir: .git
+setup: worktree: $TRASH_DIRECTORY/5
+setup: cwd: $TRASH_DIRECTORY/5
+setup: prefix: (null)
+EOF
+ test_repo 5
+'
+
+test_expect_failure '#5: in subdir' '
+ cat >5/sub/expected <<EOF &&
+setup: git_dir: .git
+setup: worktree: $TRASH_DIRECTORY/5
+setup: cwd: $TRASH_DIRECTORY/5
+setup: prefix: sub/
+EOF
+ test_repo 5/sub
+'
+
test_done