[WIP PATCH 04/18] t1510: setup case #1
---
t/t1510-repo-setup.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 88edf4d..d450b4a 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -97,4 +97,46 @@ sub/
EOF
'
+#
+# case #1
+#
+############################################################
+#
+# Input:
+#
+# - GIT_WORK_TREE is set
+# - GIT_DIR is not set
+# - core.worktree is not set
+# - .git is a directory
+# - core.bare is not set, cwd is outside .git
+#
+# Output: same as case #0 (with warnings perhaps)
+
+test_expect_success '#1: setup' '
+ unset GIT_DIR GIT_WORK_TREE &&
+ mkdir 1 1/sub 1.wt 1.wt/sub 1/wt 1/wt/sub &&
+ cd 1 && git init && cd ..
+'
+
+# FIXME: check for warning that GIT_WORK_TREE is ignored
+test_expect_failure '#1: at root' '
+ cat >1/expected <<EOF &&
+.git
+$TRASH_DIRECTORY/1
+$TRASH_DIRECTORY/1
+EOF
+ GIT_WORK_TREE=non-existent test_repo 1
+'
+
+# FIXME: check for warning that GIT_WORK_TREE is ignored
+test_expect_failure '#1: in subdir' '
+ cat >1/sub/expected <<EOF &&
+.git
+$TRASH_DIRECTORY/1
+$TRASH_DIRECTORY/1
+sub/
+EOF
+ GIT_WORK_TREE=non-existent test_repo 1/sub
+'
+
test_done
--
1.7.0.2.445.gcbdb3