Skip to content

Commit 713b372

Browse files
pcloudsgitster
authored andcommitted
t1510: setup case #12
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c3b0a0 commit 713b372

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

t/t1510-repo-setup.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,4 +1567,53 @@ EOF
15671567
test_repo 11/sub/sub "$TRASH_DIRECTORY/11/.git" "$TRASH_DIRECTORY"
15681568
'
15691569

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+
15701619
test_done

0 commit comments

Comments
 (0)