@matheusbsbs / matheus-bagliano / commits / bc25c1038f
Fork 0

t1510: setup case #9

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 bc25c1038f2b90be377b670fb8566cf94650ffa0
1 file changed +49
t/t1510-repo-setup.sh
+49
@@ -1184,4 +1184,53 @@ EOF
1184 test_repo 8/sub
1185 '
1186
1187 +#
1188 +# case #9
1189 +#
1190 +############################################################
1191 +#
1192 +# Input:
1193 +#
1194 +# - GIT_WORK_TREE is set
1195 +# - GIT_DIR is not set
1196 +# - core.worktree is not set
1197 +# - .git is a file
1198 +# - core.bare is not set, cwd is outside .git
1199 +#
1200 +# Output:
1201 +#
1202 +# #1 except that git_dir is set by .git file
1203 +
1204 +test_expect_success '#9: setup' '
1205 + unset GIT_DIR GIT_WORK_TREE &&
1206 + mkdir 9 9/sub 9.wt 9.wt/sub 9/wt 9/wt/sub &&
1207 + cd 9 &&
1208 + git init &&
1209 + mv .git ../9.git &&
1210 + echo gitdir: ../9.git >.git &&
1211 + GIT_WORK_TREE=non-existent &&
1212 + export GIT_WORK_TREE &&
1213 + cd ..
1214 +'
1215 +
1216 +test_expect_failure '#9: at root' '
1217 + cat >9/expected <<EOF &&
1218 +setup: git_dir: $TRASH_DIRECTORY/9.git
1219 +setup: worktree: $TRASH_DIRECTORY/9
1220 +setup: cwd: $TRASH_DIRECTORY/9
1221 +setup: prefix: (null)
1222 +EOF
1223 + test_repo 9
1224 +'
1225 +
1226 +test_expect_failure '#9: in subdir' '
1227 + cat >9/sub/expected <<EOF &&
1228 +setup: git_dir: $TRASH_DIRECTORY/9.git
1229 +setup: worktree: $TRASH_DIRECTORY/9
1230 +setup: cwd: $TRASH_DIRECTORY/9
1231 +setup: prefix: sub/
1232 +EOF
1233 + test_repo 9/sub
1234 +'
1235 +
1236 test_done