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

t1510: setup case #13

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 dc1c7834b383732120f490801d5f8471aa050f2f
1 file changed +50
t/t1510-repo-setup.sh
+50
@@ -1616,4 +1616,54 @@ EOF
1616 test_repo 12/sub
1617 '
1618
1619 +#
1620 +# case #13
1621 +#
1622 +############################################################
1623 +#
1624 +# Input:
1625 +#
1626 +# - GIT_WORK_TREE is set
1627 +# - GIT_DIR is not set
1628 +# - core.worktree is set
1629 +# - .git is a file
1630 +# - core.bare is not set, cwd is outside .git
1631 +#
1632 +# Output:
1633 +#
1634 +# #5 except that git_dir is set by .git file
1635 +
1636 +test_expect_success '#13: setup' '
1637 + unset GIT_DIR GIT_WORK_TREE &&
1638 + mkdir 13 13/sub 13/sub/sub 13.wt 13.wt/sub 13/wt 13/wt/sub &&
1639 + cd 13 &&
1640 + git init &&
1641 + git config core.worktree non-existent &&
1642 + GIT_WORK_TREE=non-existent-too &&
1643 + export GIT_WORK_TREE &&
1644 + mv .git ../13.git &&
1645 + echo gitdir: ../13.git >.git &&
1646 + cd ..
1647 +'
1648 +
1649 +test_expect_failure '#13: at root' '
1650 + cat >13/expected <<EOF &&
1651 +setup: git_dir: $TRASH_DIRECTORY/13.git
1652 +setup: worktree: $TRASH_DIRECTORY/13
1653 +setup: cwd: $TRASH_DIRECTORY/13
1654 +setup: prefix: (null)
1655 +EOF
1656 + test_repo 13
1657 +'
1658 +
1659 +test_expect_failure '#13: in subdir' '
1660 + cat >13/sub/expected <<EOF &&
1661 +setup: git_dir: $TRASH_DIRECTORY/13.git
1662 +setup: worktree: $TRASH_DIRECTORY/13
1663 +setup: cwd: $TRASH_DIRECTORY/13
1664 +setup: prefix: sub/
1665 +EOF
1666 + test_repo 13/sub
1667 +'
1668 +
1669 test_done