diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-11-26 22:32:09 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-29 13:25:55 -0800 |
commit | 773ec9319e4718e0346aa5a273e16ff5b35a0e4b (patch) | |
tree | a57527d09600793512ad53301c04409efd3cd3dd /t/t1510-repo-setup.sh | |
parent | bc25c1038f2b90be377b670fb8566cf94650ffa0 (diff) | |
download | git-773ec9319e4718e0346aa5a273e16ff5b35a0e4b.tar.gz |
t1510: setup case #10
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1510-repo-setup.sh')
-rwxr-xr-x | t/t1510-repo-setup.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh index 29f0f2a070..159ee51ac8 100755 --- a/t/t1510-repo-setup.sh +++ b/t/t1510-repo-setup.sh @@ -1233,4 +1233,71 @@ EOF 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: +# +# #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 && +setup: git_dir: $TRASH_DIRECTORY/10.git +setup: worktree: $TRASH_DIRECTORY/10 +setup: cwd: $TRASH_DIRECTORY/10 +setup: prefix: (null) +EOF + test_repo 10 "$TRASH_DIRECTORY/10/.git" +' + +test_expect_failure '#10: in subdir' ' + cat >10/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/10.git +setup: worktree: $TRASH_DIRECTORY/10/sub +setup: cwd: $TRASH_DIRECTORY/10/sub +setup: prefix: (null) +EOF + test_repo 10/sub "$TRASH_DIRECTORY/10/.git" +' + +test_expect_failure '#10: relative GIT_DIR at root' ' + cat >10/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/10.git +setup: worktree: $TRASH_DIRECTORY/10 +setup: cwd: $TRASH_DIRECTORY/10 +setup: prefix: (null) +EOF + test_repo 10 .git +' + +test_expect_failure '#10: relative GIT_DIR in subdir' ' + cat >10/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/10.git +setup: worktree: $TRASH_DIRECTORY/10/sub +setup: cwd: $TRASH_DIRECTORY/10/sub +setup: prefix: (null) +EOF + test_repo 10/sub ../.git +' + test_done |