Skip to content

Commit cdcef7d

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

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

t/t1510-repo-setup.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,4 +3786,72 @@ EOF
37863786
test_repo 25/sub
37873787
'
37883788

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

0 commit comments

Comments
 (0)