@matheusbsbs / matheus-bagliano / commits / 713b3721e2
Fork 0

t1510: setup case #12

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 713b3721e2cb8d0bc3dc8d3f43cb27fe77c4f131
1 file changed +49
t/t1510-repo-setup.sh
+49
@@ -1567,4 +1567,53 @@ EOF
1567 test_repo 11/sub/sub "$TRASH_DIRECTORY/11/.git" "$TRASH_DIRECTORY"
1568 '
1569
1570 +#
1571 +# case #12
1572 +#
1573 +############################################################
1574 +#
1575 +# Input:
1576 +#
1577 +# - GIT_WORK_TREE is not set
1578 +# - GIT_DIR is not set
1579 +# - core.worktree is set
1580 +# - .git is a file
1581 +# - core.bare is not set, cwd is outside .git
1582 +#
1583 +# Output:
1584 +#
1585 +# #4 except that git_dir is set by .git file
1586 +
1587 +
1588 +test_expect_success '#12: setup' '
1589 + unset GIT_DIR GIT_WORK_TREE &&
1590 + mkdir 12 12/sub 12/sub/sub 12.wt 12.wt/sub 12/wt 12/wt/sub &&
1591 + cd 12 &&
1592 + git init &&
1593 + git config core.worktree non-existent &&
1594 + mv .git ../12.git &&
1595 + echo gitdir: ../12.git >.git &&
1596 + cd ..
1597 +'
1598 +
1599 +test_expect_failure '#12: at root' '
1600 + cat >12/expected <<EOF &&
1601 +setup: git_dir: $TRASH_DIRECTORY/12.git
1602 +setup: worktree: $TRASH_DIRECTORY/12
1603 +setup: cwd: $TRASH_DIRECTORY/12
1604 +setup: prefix: (null)
1605 +EOF
1606 + test_repo 12
1607 +'
1608 +
1609 +test_expect_failure '#12: in subdir' '
1610 + cat >12/sub/expected <<EOF &&
1611 +setup: git_dir: $TRASH_DIRECTORY/12.git
1612 +setup: worktree: $TRASH_DIRECTORY/12
1613 +setup: cwd: $TRASH_DIRECTORY/12
1614 +setup: prefix: sub/
1615 +EOF
1616 + test_repo 12/sub
1617 +'
1618 +
1619 test_done