t1510: setup case #26
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
cdcef7d546e1ccc0b610a23c8a0831ca86b58589
1 file changed
+68
t/t1510-repo-setup.sh
+68
@@ -3786,4 +3786,72 @@ EOF
3786
test_repo 25/sub
3787
'
3788
3789
+#
3790
+# case #26
3791
+#
3792
+############################################################
3793
+#
3794
+# Input:
3795
+#
3796
+# - GIT_WORK_TREE is not set
3797
+# - GIT_DIR is set
3798
+# - core.worktree is not set
3799
+# - .git is a file
3800
+# - core.bare is set
3801
+#
3802
+# Output:
3803
+#
3804
+# #18 except git_dir is set according to .git file
3805
+
3806
+test_expect_success '#26: setup' '
3807
+ unset GIT_DIR GIT_WORK_TREE &&
3808
+ mkdir 26 26/sub &&
3809
+ cd 26 &&
3810
+ git init &&
3811
+ git config core.bare true &&
3812
+ mv .git ../26.git &&
3813
+ echo gitdir: ../26.git >.git &&
3814
+ cd ..
3815
+'
3816
+
3817
+test_expect_failure '#26: (rel) at root' '
3818
+ cat >26/expected <<EOF &&
3819
+setup: git_dir: $TRASH_DIRECTORY/26.git
3820
+setup: worktree: (null)
3821
+setup: cwd: $TRASH_DIRECTORY/26
3822
+setup: prefix: (null)
3823
+EOF
3824
+ test_repo 26 .git
3825
+'
3826
+
3827
+test_expect_failure '#26: at root' '
3828
+ cat >26/expected <<EOF &&
3829
+setup: git_dir: $TRASH_DIRECTORY/26.git
3830
+setup: worktree: (null)
3831
+setup: cwd: $TRASH_DIRECTORY/26
3832
+setup: prefix: (null)
3833
+EOF
3834
+ test_repo 26 "$TRASH_DIRECTORY/26/.git"
3835
+'
3836
+
3837
+test_expect_failure '#26: (rel) in subdir' '
3838
+ cat >26/sub/expected <<EOF &&
3839
+setup: git_dir: $TRASH_DIRECTORY/26.git
3840
+setup: worktree: (null)
3841
+setup: cwd: $TRASH_DIRECTORY/26/sub
3842
+setup: prefix: (null)
3843
+EOF
3844
+ test_repo 26/sub ../.git
3845
+'
3846
+
3847
+test_expect_failure '#26: in subdir' '
3848
+ cat >26/sub/expected <<EOF &&
3849
+setup: git_dir: $TRASH_DIRECTORY/26.git
3850
+setup: worktree: (null)
3851
+setup: cwd: $TRASH_DIRECTORY/26/sub
3852
+setup: prefix: (null)
3853
+EOF
3854
+ test_repo 26/sub "$TRASH_DIRECTORY/26/.git"
3855
+'
3856
+
3857
test_done