@matheusbsbs / matheus-bagliano / commits / 8fbee484a8
Fork 0

t1510: setup case #1

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 26, 2010 at 22:32 UTC 8fbee484a8ee0f00096571aff92c253ec39f28c2
1 file changed +47
t/t1510-repo-setup.sh
+47
@@ -105,4 +105,51 @@ EOF
105 test_repo 0/sub
106 '
107
108 +#
109 +# case #1
110 +#
111 +############################################################
112 +#
113 +# Input:
114 +#
115 +# - GIT_WORK_TREE is set
116 +# - GIT_DIR is not set
117 +# - core.worktree is not set
118 +# - .git is a directory
119 +# - core.bare is not set, cwd is outside .git
120 +#
121 +# Output:
122 +#
123 +# GIT_WORK_TREE is ignored -> #0
124 +
125 +test_expect_success '#1: setup' '
126 + unset GIT_DIR GIT_WORK_TREE &&
127 + mkdir 1 1/sub 1.wt 1.wt/sub 1/wt 1/wt/sub &&
128 + cd 1 &&
129 + git init &&
130 + GIT_WORK_TREE=non-existent &&
131 + export GIT_WORK_TREE &&
132 + cd ..
133 +'
134 +
135 +test_expect_failure '#1: at root' '
136 + cat >1/expected <<EOF &&
137 +setup: git_dir: .git
138 +setup: worktree: $TRASH_DIRECTORY/1
139 +setup: cwd: $TRASH_DIRECTORY/1
140 +setup: prefix: (null)
141 +EOF
142 + test_repo 1
143 +'
144 +
145 +test_expect_failure '#1: in subdir' '
146 + cat >1/sub/expected <<EOF &&
147 +setup: git_dir: .git
148 +setup: worktree: $TRASH_DIRECTORY/1
149 +setup: cwd: $TRASH_DIRECTORY/1
150 +setup: prefix: sub/
151 +EOF
152 + test_repo 1/sub
153 +'
154 +
155 test_done