t1510: setup case #26
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 26 Nov 2010 15:32:25 +0000 (22:32 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Nov 2010 21:25:59 +0000 (13:25 -0800)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1510-repo-setup.sh

index 5be85eded3978951cb83ec3ca4f51e19a837bff8..626126f54303e3b3b65afba000a322fae0682202 100755 (executable)
@@ -3786,4 +3786,72 @@ EOF
        test_repo 25/sub
 '
 
+#
+# case #26
+#
+############################################################
+#
+# Input:
+#
+#  - GIT_WORK_TREE is not set
+#  - GIT_DIR is set
+#  - core.worktree is not set
+#  - .git is a file
+#  - core.bare is set
+#
+# Output:
+#
+# #18 except git_dir is set according to .git file
+
+test_expect_success '#26: setup' '
+       unset GIT_DIR GIT_WORK_TREE &&
+       mkdir 26 26/sub &&
+       cd 26 &&
+       git init &&
+       git config core.bare true &&
+       mv .git ../26.git &&
+       echo gitdir: ../26.git >.git &&
+       cd ..
+'
+
+test_expect_failure '#26: (rel) at root' '
+       cat >26/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/26.git
+setup: worktree: (null)
+setup: cwd: $TRASH_DIRECTORY/26
+setup: prefix: (null)
+EOF
+        test_repo 26 .git
+'
+
+test_expect_failure '#26: at root' '
+       cat >26/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/26.git
+setup: worktree: (null)
+setup: cwd: $TRASH_DIRECTORY/26
+setup: prefix: (null)
+EOF
+        test_repo 26 "$TRASH_DIRECTORY/26/.git"
+'
+
+test_expect_failure '#26: (rel) in subdir' '
+       cat >26/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/26.git
+setup: worktree: (null)
+setup: cwd: $TRASH_DIRECTORY/26/sub
+setup: prefix: (null)
+EOF
+       test_repo 26/sub ../.git
+'
+
+test_expect_failure '#26: in subdir' '
+       cat >26/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/26.git
+setup: worktree: (null)
+setup: cwd: $TRASH_DIRECTORY/26/sub
+setup: prefix: (null)
+EOF
+       test_repo 26/sub "$TRASH_DIRECTORY/26/.git"
+'
+
 test_done