[PATCH 15/34] t1510: setup case #12
From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2016-06-15 22:49:55
Subsystem:
the rest · Maintainer:
Linus Torvalds
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted> --- t/t1510-repo-setup.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 844d204..22a8894 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh@@ -1561,4 +1561,53 @@ EOF GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 11/sub/sub ' +# +# case #12 +# +############################################################ +# +# Input: +# +# - GIT_WORK_TREE is not set +# - GIT_DIR is not set +# - core.worktree is set +# - .git is a file +# - core.bare is not set, cwd is outside .git +# +# Output: +# +# #4 except that git_dir is set by .git file + + +test_expect_success '#12: setup' ' + unset GIT_DIR GIT_WORK_TREE && + mkdir 12 12/sub 12/sub/sub 12.wt 12.wt/sub 12/wt 12/wt/sub && + cd 12 && + git init && + git config core.worktree non-existent && + mv .git ../12.git && + echo gitdir: ../12.git >.git && + cd .. +' + +test_expect_failure '#12: at root' ' + cat >12/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/12.git +setup: worktree: $TRASH_DIRECTORY/12 +setup: cwd: $TRASH_DIRECTORY/12 +setup: prefix: (null) +EOF + test_repo 12 +' + +test_expect_failure '#12: in subdir' ' + cat >12/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/12.git +setup: worktree: $TRASH_DIRECTORY/12 +setup: cwd: $TRASH_DIRECTORY/12 +setup: prefix: sub/ +EOF + test_repo 12/sub +' + test_done
--
1.7.0.2.445.gcbdb3