--- t/t1510-repo-setup.sh | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 132 insertions(+), 0 deletions(-) diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh index 1516ff6..2a69a78 100755 --- a/t/t1510-repo-setup.sh +++ b/t/t1510-repo-setup.sh @@ -1813,4 +1813,136 @@ EOF test_repo 12 ' +# +# case #13 +# +############################################################ +# +# Input: +# +# - GIT_WORK_TREE is set +# - GIT_DIR is not set +# - core.worktree is set +# - .git is a file +# - core.bare is not set, cwd is outside .git +# +# Output: +# +# same as case #5 except that git_dir is set by .git file + +test_expect_success '#13: setup' ' + unset GIT_DIR GIT_WORK_TREE && + mkdir 13 13/sub 13/sub/sub 13.wt 13.wt/sub 13/wt 13/wt/sub && + cd 13 && + git init && + mv .git ../13.git && + echo gitdir: ../13.git >.git && + cd .. && + export GIT_WORK_TREE=non-existent +' + +test_expect_failure '#13: core.worktree(rel), at root' ' + cat >13/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13 +$TRASH_DIRECTORY/13 +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree .. && + test_repo 13 +' + +test_expect_failure '#13: core.worktree, at root' ' + cat >13/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13 +$TRASH_DIRECTORY/13 +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree "$TRASH_DIRECTORY/13" && + test_repo 13 +' + +test_expect_failure '#13: core.worktree(rel), in subdir' ' + cat >13/sub/sub/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13 +$TRASH_DIRECTORY/13 +sub/sub/ +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree .. && + test_repo 13/sub/sub +' + +test_expect_failure '#13: core.worktree, in subdir' ' + cat >13/sub/sub/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13 +$TRASH_DIRECTORY/13 +sub/sub/ +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree "$TRASH_DIRECTORY/13" && + test_repo 13/sub/sub +' + +test_expect_failure '#13: core.worktree=wt(rel), at root' ' + cat >13/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13/wt +$TRASH_DIRECTORY/13 +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree ../wt && + test_repo 13 +' + +test_expect_failure '#13: core.worktree=wt, at root' ' + cat >13/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13/wt +$TRASH_DIRECTORY/13 +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree "$TRASH_DIRECTORY/13/wt" && + test_repo 13 +' + +test_expect_failure '#13: core.worktree=wt(rel), in subdir' ' + cat >13/sub/sub/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13/wt +$TRASH_DIRECTORY/13/sub/sub +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree ../wt && + test_repo 13/sub/sub +' + +test_expect_failure '#13: core.worktree=wt, in subdir' ' + cat >13/sub/sub/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY/13/wt +$TRASH_DIRECTORY/13/sub/sub +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree "$TRASH_DIRECTORY/13/wt" && + test_repo 13/sub/sub +' + +test_expect_failure '#13: core.worktree=..(rel), at root' ' + cat >13/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY +$TRASH_DIRECTORY +13/ +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree ../.. && + test_repo 13 +' + +test_expect_failure '#13: core.worktree=.., at root' ' + cat >13/expected <<EOF && +$TRASH_DIRECTORY/13.git +$TRASH_DIRECTORY +$TRASH_DIRECTORY +13/ +EOF + git config --file="$TRASH_DIRECTORY/13.git/config" core.worktree "$TRASH_DIRECTORY/13" && + test_repo 13 +' + 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