Skip to content

Commit 6ab5da1

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

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
@@ -4171,4 +4171,54 @@ EOF
41714171
test_repo 28/sub
41724172
'
41734173

4174+
#
4175+
# case #29
4176+
#
4177+
############################################################
4178+
#
4179+
# Input:
4180+
#
4181+
# - GIT_WORK_TREE is set
4182+
# - GIT_DIR is not set
4183+
# - core.worktree is set
4184+
# - .git is a file
4185+
# - core.bare is set
4186+
#
4187+
# Output:
4188+
#
4189+
# GIT_WORK_TREE/core.worktree are ignored -> #28
4190+
4191+
test_expect_success '#29: setup' '
4192+
unset GIT_DIR GIT_WORK_TREE &&
4193+
mkdir 29 29/sub &&
4194+
cd 29 &&
4195+
git init &&
4196+
git config core.bare true &&
4197+
GIT_WORK_TREE=non-existent &&
4198+
export GIT_WORK_TREE &&
4199+
mv .git ../29.git &&
4200+
echo gitdir: ../29.git >.git &&
4201+
cd ..
4202+
'
4203+
4204+
test_expect_failure '#29: at root' '
4205+
cat >29/expected <<EOF &&
4206+
setup: git_dir: $TRASH_DIRECTORY/29.git
4207+
setup: worktree: (null)
4208+
setup: cwd: $TRASH_DIRECTORY/29
4209+
setup: prefix: (null)
4210+
EOF
4211+
test_repo 29
4212+
'
4213+
4214+
test_expect_failure '#29: in subdir' '
4215+
cat >29/sub/expected <<EOF &&
4216+
setup: git_dir: $TRASH_DIRECTORY/29.git
4217+
setup: worktree: (null)
4218+
setup: cwd: $TRASH_DIRECTORY/29/sub
4219+
setup: prefix: (null)
4220+
EOF
4221+
test_repo 29/sub
4222+
'
4223+
41744224
test_done

0 commit comments

Comments
 (0)