@matheusbsbs / matheus-bagliano / commits / 468d68226c
Fork 0

t1510: setup case #25

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 468d68226c6514a1c30390819da96c8a495c23d0
1 file changed +50
t/t1510-repo-setup.sh
+50
@@ -3736,4 +3736,54 @@ EOF
3736 test_repo 24/sub
3737 '
3738
3739 +#
3740 +# case #25
3741 +#
3742 +############################################################
3743 +#
3744 +# Input:
3745 +#
3746 +# - GIT_WORK_TREE is set
3747 +# - GIT_DIR is not set
3748 +# - core.worktree is not set
3749 +# - .git is a file
3750 +# - core.bare is set
3751 +#
3752 +# Output:
3753 +#
3754 +# #17.2 except git_dir is set according to .git file
3755 +
3756 +test_expect_success '#25: setup' '
3757 + unset GIT_DIR GIT_WORK_TREE &&
3758 + mkdir 25 25/sub &&
3759 + cd 25 &&
3760 + git init &&
3761 + git config core.bare true &&
3762 + GIT_WORK_TREE=non-existent &&
3763 + export GIT_WORK_TREE &&
3764 + mv .git ../25.git &&
3765 + echo gitdir: ../25.git >.git &&
3766 + cd ..
3767 +'
3768 +
3769 +test_expect_failure '#25: at root' '
3770 + cat >25/expected <<EOF &&
3771 +setup: git_dir: $TRASH_DIRECTORY/25.git
3772 +setup: worktree: (null)
3773 +setup: cwd: $TRASH_DIRECTORY/25
3774 +setup: prefix: (null)
3775 +EOF
3776 + test_repo 25
3777 +'
3778 +
3779 +test_expect_failure '#25: in subdir' '
3780 + cat >25/sub/expected <<EOF &&
3781 +setup: git_dir: $TRASH_DIRECTORY/25.git
3782 +setup: worktree: (null)
3783 +setup: cwd: $TRASH_DIRECTORY/25/sub
3784 +setup: prefix: (null)
3785 +EOF
3786 + test_repo 25/sub
3787 +'
3788 +
3789 test_done