From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 17/34] t1510: setup case #14
Date: Wed, 27 Oct 2010 21:49:20 +0700 [thread overview]
Message-ID: <1288190977-30875-18-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1288190977-30875-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 | 291 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 291 insertions(+), 0 deletions(-)
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index ec0a993..0cd00ea 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -1659,4 +1659,295 @@ EOF
test_repo 13/sub
'
+#
+# case #14
+#
+############################################################
+#
+# Input:
+#
+# - GIT_WORK_TREE is not set
+# - GIT_DIR is set
+# - core.worktree is set
+# - .git is a file
+# - core.bare is not set, cwd is outside .git
+#
+# Output:
+#
+# #6 except that git_dir is set by .git file
+
+test_expect_success '#14: setup' '
+ unset GIT_DIR GIT_WORK_TREE &&
+ mkdir 14 14/sub 14/sub/sub 14.wt 14.wt/sub 14/wt 14/wt/sub &&
+ cd 14 &&
+ git init &&
+ mv .git ../14.git &&
+ echo gitdir: ../14.git >.git &&
+ cd ..
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14" &&
+ GIT_DIR=.git test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree .. &&
+ GIT_DIR=.git test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=.. at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14" &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree .. &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14" &&
+ GIT_DIR=../../.git test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree .. &&
+ GIT_DIR=../../.git test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=.. in subdir' '
+ cat >14/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14" &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree .. &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../wt at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14/wt" &&
+ GIT_DIR=.git test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../wt(rel) at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../wt &&
+ GIT_DIR=.git test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../wt(rel) at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../wt &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../wt at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14/wt" &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../wt in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14/sub/sub
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14/wt" &&
+ GIT_DIR=../../.git test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../wt(rel) in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14/sub/sub
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../wt &&
+ GIT_DIR=../../.git test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../wt(rel) in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14/sub/sub
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../wt &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../wt in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY/14/wt
+setup: cwd: $TRASH_DIRECTORY/14/sub/sub
+setup: prefix: (null)
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY/14/wt" &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../.. at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY" &&
+ GIT_DIR=.git test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../..(rel) at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../../ &&
+ GIT_DIR=.git test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../..(rel) at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../../ &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../.. at root' '
+ cat >14/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY" &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../.. in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY" &&
+ GIT_DIR=../../.git test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../.. &&
+ GIT_DIR=../../.git test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../..(rel) in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree ../.. &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
+'
+
+test_expect_failure '#14: GIT_DIR, core.worktree=../.. in subdir' '
+ cat >14/sub/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/14.git
+setup: worktree: $TRASH_DIRECTORY
+setup: cwd: $TRASH_DIRECTORY
+setup: prefix: 14/sub/sub/
+EOF
+ git config --file="$TRASH_DIRECTORY/14.git/config" core.worktree "$TRASH_DIRECTORY" &&
+ GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
+'
+
test_done
--
1.7.0.2.445.gcbdb3
next prev parent reply other threads:[~2010-10-27 14:52 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 14:49 [PATCH 00/34] repo setup test cases Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 01/34] builtins: print setup info if repo is found Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 02/34] Add t1510 and basic rules that run repo setup Nguyễn Thái Ngọc Duy
2010-10-27 15:37 ` Nguyen Thai Ngoc Duy
2010-10-27 16:30 ` Jonathan Nieder
2010-10-28 0:16 ` Nguyen Thai Ngoc Duy
2010-10-27 14:49 ` [PATCH 03/34] t1510: setup case #0 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 04/34] t1510: setup case #1 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 05/34] t1510: setup case #2 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 06/34] t1510: setup case #3 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 07/34] t1510: setup case #4 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 08/34] t1510: setup case #5 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 09/34] t1510: setup case #6 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 10/34] t1510: setup case #7 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 11/34] t1510: setup case #8 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 12/34] t1510: setup case #9 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 13/34] t1510: setup case #10 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 14/34] t1510: setup case #11 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 15/34] t1510: setup case #12 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 16/34] t1510: setup case #13 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` Nguyễn Thái Ngọc Duy [this message]
2010-10-27 14:49 ` [PATCH 18/34] t1510: setup case #15 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 19/34] t1510: setup case #16 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 20/34] t1510: setup case #17 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 21/34] t1510: setup case #18 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 22/34] t1510: setup case #19 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 23/34] t1510: setup case #20 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 24/34] t1510: setup case #21 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 25/34] t1510: setup case #22 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 26/34] t1510: setup case #23 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 27/34] t1510: setup case #24 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 28/34] t1510: setup case #25 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 29/34] t1510: setup case #26 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 30/34] t1510: setup case #27 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 31/34] t1510: setup case #28 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 32/34] t1510: setup case #29 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 33/34] t1510: setup case #30 Nguyễn Thái Ngọc Duy
2010-10-27 14:49 ` [PATCH 34/34] t1510: setup case #31 Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 1/7] setup: support setting GIT_DIR=.git file Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 2/7] unset: discard GIT_WORK_TREE if GIT_DIR is not set Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 3/7] setup: do not allow core.{bare,worktree} set at the same time Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 4/7] setup: skip core.worktree if GIT_DIR is not set Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 5/7] setup: rework core.worktree Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 6/7] get_git_work_tree: core.worktree relative to git_dir Nguyễn Thái Ngọc Duy
2010-10-27 14:58 ` [PATCH 7/7] new failures Nguyễn Thái Ngọc Duy
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=1288190977-30875-18-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/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).