t1510: setup case #8
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
9a5976cd389c1c0b31cb3f9b3d260c0d05521f4c
1 file changed
+47
t/t1510-repo-setup.sh
+47
@@ -1137,4 +1137,51 @@ EOF
1137
test_repo 7/sub/sub "$TRASH_DIRECTORY/7/.git" "$TRASH_DIRECTORY"
1138
'
1139
1140
+#
1141
+# case #8
1142
+#
1143
+############################################################
1144
+#
1145
+# Input:
1146
+#
1147
+# - GIT_WORK_TREE is not set
1148
+# - GIT_DIR is not set
1149
+# - core.worktree is not set
1150
+# - .git is a file
1151
+# - core.bare is not set, cwd is outside .git
1152
+#
1153
+# Output:
1154
+#
1155
+# #0 except that git_dir is set by .git file
1156
+
1157
+test_expect_success '#8: setup' '
1158
+ unset GIT_DIR GIT_WORK_TREE &&
1159
+ mkdir 8 8/sub &&
1160
+ cd 8 &&
1161
+ git init &&
1162
+ mv .git ../8.git &&
1163
+ echo gitdir: ../8.git >.git &&
1164
+ cd ..
1165
+'
1166
+
1167
+test_expect_success '#8: at root' '
1168
+ cat >8/expected <<EOF &&
1169
+setup: git_dir: $TRASH_DIRECTORY/8.git
1170
+setup: worktree: $TRASH_DIRECTORY/8
1171
+setup: cwd: $TRASH_DIRECTORY/8
1172
+setup: prefix: (null)
1173
+EOF
1174
+ test_repo 8
1175
+'
1176
+
1177
+test_expect_success '#8: in subdir' '
1178
+ cat >8/sub/expected <<EOF &&
1179
+setup: git_dir: $TRASH_DIRECTORY/8.git
1180
+setup: worktree: $TRASH_DIRECTORY/8
1181
+setup: cwd: $TRASH_DIRECTORY/8
1182
+setup: prefix: sub/
1183
+EOF
1184
+ test_repo 8/sub
1185
+'
1186
+
1187
test_done