From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org, Jonathan Niedier <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 30/42] t1510: setup case #27
Date: Fri, 29 Oct 2010 13:48:42 +0700 [thread overview]
Message-ID: <1288334934-17216-31-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1288334934-17216-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/t1510-repo-setup.sh | 268 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 268 insertions(+), 0 deletions(-)
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 270af69..e8e8d82 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -3840,4 +3840,272 @@ EOF
GIT_DIR="$TRASH_DIRECTORY/26/.git" test_repo 26/sub
'
+#
+# case #27
+#
+############################################################
+#
+# Input:
+#
+# - GIT_WORK_TREE is set
+# - GIT_DIR is set
+# - .git is a file
+# - core.worktree is not set
+# - core.bare is set
+#
+# Output:
+#
+# #19 except git_dir is set according to .git file
+
+test_expect_success '#27: setup' '
+ unset GIT_DIR GIT_WORK_TREE &&
+ mkdir 27 27/sub 27/sub/sub 27.wt 27.wt/sub 27/wt 27/wt/sub &&
+ cd 27 &&
+ git init &&
+ git config core.bare true &&
+ mv .git ../27.git &&
+ echo gitdir: ../27.git >.git &&
+ cd ..
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR=.git GIT_WORK_TREE=. test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=. test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: sub/sub/
+EOF
+ GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: sub/sub/
+EOF
+ GIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '
+ cat >27/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: sub/
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27/sub
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: sub/sub/
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=../.. test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR=.git GIT_WORK_TREE=wt test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=wt test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27
+setup: prefix: (null)
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27/sub/sub
+setup: prefix: (null)
+EOF
+ GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27/sub/sub
+setup: prefix: (null)
+EOF
+ GIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27/sub/sub
+setup: prefix: (null)
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=../../wt test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY/27/wt
+setup: cwd: $TRASH_DIRECTORY/27/sub/sub
+setup: prefix: (null)
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/
+EOF
+ GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/
+EOF
+ GIT_DIR=.git GIT_WORK_TREE=.. test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=.. test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '
+ cat >27/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/sub/sub/
+EOF
+ GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/sub/sub/
+EOF
+ GIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/sub/sub/
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=../../../ test_repo 27/sub/sub
+'
+
+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
+ cat >27/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/27.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 27/sub/sub/
+EOF
+ GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27/sub/sub
+'
+
test_done
--
1.7.0.2.445.gcbdb3
next prev parent reply other threads:[~2010-10-29 6:53 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 6:48 [PATCH 00/42] repo setup test cases and fixes Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 01/42] builtins: print setup info if repo is found Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 02/42] Add t1510 and basic rules that run repo setup Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 03/42] t1510: setup case #0 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 04/42] t1510: setup case #1 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 05/42] t1510: setup case #2 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 06/42] t1510: setup case #3 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 07/42] t1510: setup case #4 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 08/42] t1510: setup case #5 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 09/42] t1510: setup case #6 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 10/42] t1510: setup case #7 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 11/42] t1510: setup case #8 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 12/42] t1510: setup case #9 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 13/42] t1510: setup case #10 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 14/42] t1510: setup case #11 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 15/42] t1510: setup case #12 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 16/42] t1510: setup case #13 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 17/42] t1510: setup case #14 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 18/42] t1510: setup case #15 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 19/42] t1510: setup case #16 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 20/42] t1510: setup case #17 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 21/42] t1510: setup case #18 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 22/42] t1510: setup case #19 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 23/42] t1510: setup case #20 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 24/42] t1510: setup case #21 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 25/42] t1510: setup case #22 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 26/42] t1510: setup case #23 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 27/42] t1510: setup case #24 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 28/42] t1510: setup case #25 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 29/42] t1510: setup case #26 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` Nguyễn Thái Ngọc Duy [this message]
2010-10-29 6:48 ` [PATCH 31/42] t1510: setup case #28 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 32/42] t1510: setup case #29 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 33/42] t1510: setup case #30 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 34/42] t1510: setup case #31 Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd Nguyễn Thái Ngọc Duy
2010-10-29 17:06 ` Sverre Rabbelier
2010-10-30 4:42 ` Nguyen Thai Ngoc Duy
2010-10-30 7:09 ` Jonathan Nieder
2010-10-29 6:48 ` [PATCH 36/42] Add git_config_early() Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 37/42] Use git_config_early() instead of git_config() during repo setup Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 38/42] Remove all logic from get_git_work_tree() Nguyễn Thái Ngọc Duy
2010-10-29 17:09 ` Sverre Rabbelier
2010-10-30 4:38 ` Nguyen Thai Ngoc Duy
2010-11-01 6:26 ` [PATCH 1/9] git-rev-parse.txt: clarify --git-dir Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 2/9] rev-parse: prints --git-dir relative to user's cwd Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 3/9] Add git_config_early() Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 4/9] Use git_config_early() instead of git_config() during repo setup Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 5/9] setup: limit get_git_work_tree()'s to explicit setup case only Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 6/9] setup: clean up setup_bare_git_dir() Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 7/9] setup: clean up setup_discovered_git_dir() Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 8/9] setup: rework setup_explicit_git_dir() Nguyễn Thái Ngọc Duy
2010-11-01 6:26 ` [PATCH 9/9] Remove all logic from get_git_work_tree() Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 39/42] setup: clean up setup_bare_git_dir() Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 40/42] setup: clean up setup_discovered_git_dir() Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 41/42] setup: rework setup_explicit_git_dir() Nguyễn Thái Ngọc Duy
2010-10-29 6:48 ` [PATCH 42/42] t1510: all failed tests are now fixed Nguyễn Thái Ngọc Duy
2010-10-29 8:29 ` Nguyen Thai Ngoc Duy
2010-10-29 17:04 ` [PATCH 00/42] repo setup test cases and fixes Sverre Rabbelier
2010-10-29 17:09 ` Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288334934-17216-31-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).