diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-11-26 22:32:18 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-29 13:25:57 -0800 |
commit | 09327fd8f77cc7115684902528a5ba31bd6c5cff (patch) | |
tree | 17508977d61741de18024308478b2b8ba8b9ef2b /t/t1510-repo-setup.sh | |
parent | 37eecb3db60843f54bf53f4168bb7fd1d1001c58 (diff) | |
download | git-09327fd8f77cc7115684902528a5ba31bd6c5cff.tar.gz |
t1510: setup case #19
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 | 266 |
1 files changed, 266 insertions, 0 deletions
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh index a828b0355b..1362902988 100755 --- a/t/t1510-repo-setup.sh +++ b/t/t1510-repo-setup.sh @@ -2560,4 +2560,270 @@ EOF test_repo 18/sub "$TRASH_DIRECTORY/18/.git" ' +# +# case #19 +# +############################################################ +# +# Input: +# +# - GIT_WORK_TREE is set +# - GIT_DIR is set +# - .git is a directory +# - core.worktree is not set +# - core.bare is set +# +# Output: +# +# bare repo is overridden by GIT_WORK_TREE -> #3 + +test_expect_success '#19: setup' ' + unset GIT_DIR GIT_WORK_TREE && + mkdir 19 19/sub 19/sub/sub 19.wt 19.wt/sub 19/wt 19/wt/sub && + cd 19 && + git init && + git config core.bare true && + cd .. +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=root at root' ' + cat >19/expected <<EOF && +setup: git_dir: .git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 .git "$TRASH_DIRECTORY/19" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' ' + cat >19/expected <<EOF && +setup: git_dir: .git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 .git . +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=root at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 "$TRASH_DIRECTORY/19/.git" "$TRASH_DIRECTORY/19" +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=root(rel) at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 "$TRASH_DIRECTORY/19/.git" . +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORKTREE=root in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: sub/sub/ +EOF + test_repo 19/sub/sub ../../.git "$TRASH_DIRECTORY/19" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: sub/sub/ +EOF + test_repo 19/sub/sub ../../.git ../.. +' + +test_expect_success '#19: GIT_DIR, GIT_WORKTREE=root in subdir' ' + cat >19/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: sub/ +EOF + test_repo 19/sub "$TRASH_DIRECTORY/19/.git" "$TRASH_DIRECTORY/19" +' + +test_expect_success '#19: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19 +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: sub/sub/ +EOF + test_repo 19/sub/sub "$TRASH_DIRECTORY/19/.git" ../.. +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt at root' ' + cat >19/expected <<EOF && +setup: git_dir: .git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 .git "$TRASH_DIRECTORY/19/wt" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' ' + cat >19/expected <<EOF && +setup: git_dir: .git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 .git wt +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 "$TRASH_DIRECTORY/19/.git" wt +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19 +setup: prefix: (null) +EOF + test_repo 19 "$TRASH_DIRECTORY/19/.git" "$TRASH_DIRECTORY/19/wt" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: ../../.git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19/sub/sub +setup: prefix: (null) +EOF + test_repo 19/sub/sub ../../.git "$TRASH_DIRECTORY/19/wt" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: ../../.git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19/sub/sub +setup: prefix: (null) +EOF + test_repo 19/sub/sub ../../.git ../../wt +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19/sub/sub +setup: prefix: (null) +EOF + test_repo 19/sub/sub "$TRASH_DIRECTORY/19/.git" ../../wt +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY/19/wt +setup: cwd: $TRASH_DIRECTORY/19/sub/sub +setup: prefix: (null) +EOF + test_repo 19/sub/sub "$TRASH_DIRECTORY/19/.git" "$TRASH_DIRECTORY/19/wt" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=.. at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/ +EOF + test_repo 19 .git "$TRASH_DIRECTORY" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/ +EOF + test_repo 19 .git .. +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=..(rel) at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/ +EOF + test_repo 19 "$TRASH_DIRECTORY/19/.git" .. +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=.. at root' ' + cat >19/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/ +EOF + test_repo 19 "$TRASH_DIRECTORY/19/.git" "$TRASH_DIRECTORY" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/sub/sub/ +EOF + test_repo 19/sub/sub ../../.git "$TRASH_DIRECTORY" +' + +test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/sub/sub/ +EOF + test_repo 19/sub/sub ../../.git ../../.. +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/sub/sub/ +EOF + test_repo 19/sub/sub "$TRASH_DIRECTORY/19/.git" ../../../ +' + +test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=.. in subdir' ' + cat >19/sub/sub/expected <<EOF && +setup: git_dir: $TRASH_DIRECTORY/19/.git +setup: worktree: $TRASH_DIRECTORY +setup: cwd: $TRASH_DIRECTORY +setup: prefix: 19/sub/sub/ +EOF + test_repo 19/sub/sub "$TRASH_DIRECTORY/19/.git" "$TRASH_DIRECTORY" +' + test_done |