Thread (23 messages) flat view 23 messages, 3 authors, 2016-06-15
DORMANTno replies

[WIP PATCH 03/18] t1510: setup case #0

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:49:52
Subsystem: the rest · Maintainer: Linus Torvalds

---
 t/t1510-repo-setup.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index d618787..88edf4d 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -53,4 +53,48 @@ test_repo() {
 # Bit 4 = bare repo
 # Case# = encoding of the above 5 bits
 
+#
+# Case #0
+#
+############################################################
+#
+# Input:
+#
+#  - GIT_WORK_TREE is not 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:
+#
+#  - worktree is .git's parent directory
+#  - cwd is at worktree root dir
+#  - prefix is calculated
+#  - git_dir is set to ".git"
+#  - cwd can't be outside worktree
+
+test_expect_success '#0: setup' '
+	unset GIT_DIR GIT_WORK_TREE &&
+	mkdir 0 0/sub &&
+	cd 0 && git init && cd ..
+'
+
+test_expect_success '#0: at root' '
+	cat >0/expected <<EOF && test_repo 0
+.git
+$TRASH_DIRECTORY/0
+$TRASH_DIRECTORY/0
+EOF
+'
+
+test_expect_success '#0: in subdir' '
+	cat >0/sub/expected <<EOF && test_repo 0/sub
+.git
+$TRASH_DIRECTORY/0
+$TRASH_DIRECTORY/0
+sub/
+EOF
+'
+
 test_done
-- 
1.7.0.2.445.gcbdb3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help