Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx> --- t/t1510-repo-setup.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh index 5ca9f4a..1406a8d 100755 --- a/t/t1510-repo-setup.sh +++ b/t/t1510-repo-setup.sh @@ -1180,4 +1180,51 @@ EOF test_repo 8/sub ' +# +# case #9 +# +############################################################ +# +# Input: +# +# - GIT_WORK_TREE is set +# - GIT_DIR is not set +# - core.worktree is not set +# - .git is a file +# - core.bare is not set, cwd is outside .git +# +# Output: +# +# #1 except that git_dir is set by .git file + +test_expect_success '#9: setup' ' + unset GIT_DIR GIT_WORK_TREE && + mkdir 9 9/sub 9.wt 9.wt/sub 9/wt 9/wt/sub && + cd 9 && + git init && + mv .git ../9.git && + echo gitdir: ../9.git >.git && + cd .. +' + +test_expect_failure '#9: at root' ' + cat >9/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/9.git +setup: worktree: $TRASH_DIRECTORY/9 +setup: cwd: $TRASH_DIRECTORY/9 +setup: prefix: (null) +EOF + GIT_WORK_TREE=non-existent test_repo 9 +' + +test_expect_failure '#9: in subdir' ' + cat >9/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/9.git +setup: worktree: $TRASH_DIRECTORY/9 +setup: cwd: $TRASH_DIRECTORY/9 +setup: prefix: sub/ +EOF + GIT_WORK_TREE=non-existent test_repo 9/sub +' + test_done -- 1.7.0.2.445.gcbdb3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html