[WIP PATCH 13/18] t1510: setup case #10
From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:49:52
Subsystem:
the rest · Maintainer:
Linus Torvalds
--- t/t1510-repo-setup.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index c516155..31bacd7 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh@@ -1363,4 +1363,67 @@ EOF GIT_WORK_TREE=non-existent test_repo 9/sub ' +# +# case #10 +# +############################################################ +# +# Input: +# +# - GIT_WORK_TREE is not set +# - GIT_DIR is set +# - core.worktree is not set +# - .git is a file +# - core.bare is not set, cwd is outside .git +# +# Output: +# +# same as case #2 except that git_dir is set by .git file + +test_expect_success '#10: setup' ' + unset GIT_DIR GIT_WORK_TREE && + mkdir 10 10/sub && + cd 10 && + git init && + mv .git ../10.git && + echo gitdir: ../10.git >.git && + cd .. +' + +test_expect_failure '#10: at root' ' + cat >10/expected <<EOF && +$TRASH_DIRECTORY/10.git +$TRASH_DIRECTORY/10 +$TRASH_DIRECTORY/10 +EOF + GIT_DIR="$TRASH_DIRECTORY/10/.git" test_repo 10 +' + +test_expect_failure '#10: in subdir' ' + cat >10/sub/expected <<EOF && +$TRASH_DIRECTORY/10.git +$TRASH_DIRECTORY/10/sub +$TRASH_DIRECTORY/10/sub +EOF + GIT_DIR="$TRASH_DIRECTORY/10/.git" test_repo 10/sub +' + +test_expect_failure '#10: relative GIT_DIR at root' ' + cat >10/expected <<EOF && +$TRASH_DIRECTORY/10.git +$TRASH_DIRECTORY/10 +$TRASH_DIRECTORY/10 +EOF + GIT_DIR=.git test_repo 10 +' + +test_expect_failure '#10: relative GIT_DIR in subdir' ' + cat >10/sub/expected <<EOF && +$TRASH_DIRECTORY/10.git +$TRASH_DIRECTORY/10/sub +$TRASH_DIRECTORY/10/sub +EOF + GIT_DIR=../.git test_repo 10/sub +' + test_done
--
1.7.0.2.445.gcbdb3