git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 05/34] t1510: setup case #2
Date: Wed, 27 Oct 2010 21:49:08 +0700	[thread overview]
Message-ID: <1288190977-30875-6-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 |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 0ff659a..bf008c6 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -149,4 +149,71 @@ EOF
 	test_repo 1/sub
 '
 
+#
+# case #2
+#
+############################################################
+#
+# Input:
+#
+#  - GIT_WORK_TREE is not set
+#  - GIT_DIR is set
+#  - core.worktree is not set
+#  - .git is a directory
+#  - core.bare is not set, cwd is outside .git
+#
+# Output:
+#
+#  - worktree is at original cwd
+#  - cwd is unchanged
+#  - prefix is NULL
+#  - git_dir is set to $GIT_DIR
+#  - cwd can't be outside worktree
+
+test_expect_success '#2: setup' '
+	unset GIT_DIR GIT_WORK_TREE &&
+	mkdir 2 2/sub &&
+	cd 2 && git init && cd ..
+'
+
+test_expect_success '#2: at root' '
+	cat >2/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/2/.git
+setup: worktree: $TRASH_DIRECTORY/2
+setup: cwd: $TRASH_DIRECTORY/2
+setup: prefix: (null)
+EOF
+	GIT_DIR="$TRASH_DIRECTORY/2/.git" test_repo 2
+'
+
+test_expect_success '#2: in subdir' '
+	cat >2/sub/expected <<EOF &&
+setup: git_dir: $TRASH_DIRECTORY/2/.git
+setup: worktree: $TRASH_DIRECTORY/2/sub
+setup: cwd: $TRASH_DIRECTORY/2/sub
+setup: prefix: (null)
+EOF
+	GIT_DIR="$TRASH_DIRECTORY/2/.git" test_repo 2/sub
+'
+
+test_expect_success '#2: relative GIT_DIR at root' '
+	cat >2/expected <<EOF &&
+setup: git_dir: .git
+setup: worktree: $TRASH_DIRECTORY/2
+setup: cwd: $TRASH_DIRECTORY/2
+setup: prefix: (null)
+EOF
+	GIT_DIR=.git test_repo 2
+'
+
+test_expect_success '#2: relative GIT_DIR in subdir' '
+	cat >2/sub/expected <<EOF &&
+setup: git_dir: ../.git
+setup: worktree: $TRASH_DIRECTORY/2/sub
+setup: cwd: $TRASH_DIRECTORY/2/sub
+setup: prefix: (null)
+EOF
+	GIT_DIR=../.git test_repo 2/sub
+'
+
 test_done
-- 
1.7.0.2.445.gcbdb3

  parent reply	other threads:[~2010-10-27 14:50 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 ` Nguyễn Thái Ngọc Duy [this message]
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 ` [PATCH 17/34] t1510: setup case #14 Nguyễn Thái Ngọc Duy
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-6-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).