Skip to content

Commit 468d682

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

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

t/t1510-repo-setup.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3736,4 +3736,54 @@ EOF
37363736
test_repo 24/sub
37373737
'
37383738

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

0 commit comments

Comments
 (0)