{"thread":{"id":"25538","subject":"[WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests","startedAt":"2010-10-24T12:11:32Z","lastAt":"2010-10-25T10:30:33Z","messageCount":23,"participants":["Nguyễn Thái Ngọc Duy","Jonathan Nieder","Nguyen Thai Ngoc Duy","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":18},"messages":[{"id":"154314","messageId":"1287922310-14678-1-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":null,"subject":"[WIP PATCH 00/18] setup tests","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:32Z","receivedAt":"2010-10-24T12:11:32Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"These tests are created according to [1] and its following\ndiscussions. I have yet to create tests for the last 16 cases, which\nmight be simpler.  Tests from 8-15 are usually copy of 0-7 with some\nmodification. If you find bugs in 0-7, stop reading 8-15, it's just\nwasting time.\n\nThe rules are bent a bit the way the code does it, specifically:\n\n - GIT_WORK_TREE is relative to cwd, not GIT_DIR\n - core.worktree is always effective regardless GIT_DIR/--git-dir\n\nAlso I assume that when cwd is outside worktree, cwd should be\nunchanged (therefore prefix is NULL). This is the behavior when\nGIT_DIR and GIT_WORK_TREE are set. Let's apply it to all other cases\nwhere cwd may be outside worktree.\n\nAdjusting the expected results is not hard. So it's up to you guys.\nOnce we agree on something, I can update the tests.\n\nAlso when GIT_DIR is set, .git _file_ is not recognized because\nsetup_explicit_git_dir() does not accept it. There are a\n_lot_ of failed tests due to this. I probably should fix that,\notherwise tests #8-15 may not be very reliable.\n\n[1] http://mid.gmane.org/20101020085859.GA13135@do\n\nNguyễn Thái Ngọc Duy (18):\n  rev-parse: add --internal-cwd and --internal-git-dir for tests\n  Add t1510 for setup tests\n  t1510: setup case #0\n  t1510: setup case #1\n  t1510: setup case #2\n  t1510: setup case #3\n  t1510: setup case #4\n  t1510: setup case #5\n  t1510: setup case #6\n  t1510: setup case #7\n  t1510: setup case #8\n  t1510: setup case #9\n  t1510: setup case #10\n  t1510: setup case #11\n  t1510: setup case #12\n  t1510: setup case #13\n  t1510: setup case #14\n  t1510: setup case #15\n\n builtin/rev-parse.c   |   11 +\n t/t1510-repo-setup.sh | 2483 +++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 2494 insertions(+), 0 deletions(-)\n create mode 100755 t/t1510-repo-setup.sh\n"},{"id":"154313","messageId":"1287922310-14678-2-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:33Z","receivedAt":"2010-10-24T12:11:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"--internal-cwd is obvious, no way else to expose it for testing.\n\n--internal-git-dir is introduced because --git-dir prepares its output\nsuitable for scripting. For tests, it must be exactly what git stores.\n---\n builtin/rev-parse.c |   11 +++++++++++\n 1 files changed, 11 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex a5a1c86..454a25c 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -642,6 +642,17 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\tputchar('\\n');\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tif (!strcmp(arg, \"--internal-cwd\")) {\n+\t\t\t\tstatic char cwd[PATH_MAX];\n+\t\t\t\tif (!getcwd(cwd, PATH_MAX))\n+\t\t\t\t\tdie_errno(\"unable to get current working directory\");\n+\t\t\t\tputs(cwd);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (!strcmp(arg, \"--internal-git-dir\")) {\n+\t\t\t\tputs(get_git_dir());\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tif (!strcmp(arg, \"--git-dir\")) {\n \t\t\t\tconst char *gitdir = getenv(GIT_DIR_ENVIRONMENT);\n \t\t\t\tstatic char cwd[PATH_MAX];\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154315","messageId":"1287922310-14678-3-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 02/18] Add t1510 for setup tests","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:34Z","receivedAt":"2010-10-24T12:11:34Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   56 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 56 insertions(+), 0 deletions(-)\n create mode 100755 t/t1510-repo-setup.sh\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nnew file mode 100755\nindex 0000000..d618787\n--- /dev/null\n+++ b/t/t1510-repo-setup.sh\n@@ -0,0 +1,56 @@\n+#!/bin/sh\n+\n+test_description='Tests of cwd/prefix/worktree/gitdir setup in all cases'\n+\n+. ./test-lib.sh\n+\n+# A few principles for repo setup:\n+#\n+# 1. GIT_DIR is relative to user's cwd. This directory is refered as\n+#    \"git_dir\" below. Auto discovered repo is also \"git_dir\".\n+#    --git-dir is equivalent to GIT_DIR.\n+#\n+# 2. core.worktree is relative to git_dir\n+#\n+# 3. GIT_WORK_TREE is relative to user's cwd. --work-tree is\n+#    equivalent to GIT_WORK_TREE.\n+#\n+# 4. .git file is relative to git_dir. Note that the repo where .git\n+#    file points to is not considered \"git_dir\" in the above.\n+#\n+# 5. GIT_WORK_TREE is only effective if GIT_DIR is\n+#    set (hence \"Effective GIT_WORK_TREE\"\n+#    below). Uneffective GIT_WORK_TREE should be warned.\n+#\n+# 6. Effective GIT_WORK_TREE will override core.worktree\n+#\n+# 7. During repo discovery, if \".\" is found a repo, it is considered a\n+#    bare repo unless core.worktree is set\n+#\n+# 8. core.bare conflicts with core.worktree\n+#\n+# 9. Effective GIT_WORK_TREE will override core.bare\n+#\n+# 10. When user's cwd is outside worktree, cwd will remain unchanged,\n+#     prefix be NULL.\n+\n+test_repo() {\n+\t(\n+\tif [ -n \"$1\" ]; then cd \"$1\"; fi &&\n+\tgit symbolic-ref HEAD >/dev/null && # git_dir reachability test first\n+\tgit rev-parse --internal-git-dir >result &&\n+\tgit rev-parse --show-toplevel >>result &&\n+\tgit rev-parse --internal-cwd >>result &&\n+\tgit rev-parse --show-prefix >>result &&\n+\ttest_cmp expected result\n+\t)\n+}\n+\n+# Bit 0 = GIT_WORK_TREE\n+# Bit 1 = GIT_DIR\n+# Bit 2 = core.worktree\n+# Bit 3 = .git is a file\n+# Bit 4 = bare repo\n+# Case# = encoding of the above 5 bits\n+\n+test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154317","messageId":"1287922310-14678-4-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 03/18] t1510: setup case #0","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:35Z","receivedAt":"2010-10-24T12:11:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   44 ++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 44 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex d618787..88edf4d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -53,4 +53,48 @@ test_repo() {\n # Bit 4 = bare repo\n # Case# = encoding of the above 5 bits\n \n+#\n+# Case #0\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is not set\n+#  - core.worktree is not set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+#  - worktree is .git's parent directory\n+#  - cwd is at worktree root dir\n+#  - prefix is calculated\n+#  - git_dir is set to \".git\"\n+#  - cwd can't be outside worktree\n+\n+test_expect_success '#0: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 0 0/sub &&\n+\tcd 0 && git init && cd ..\n+'\n+\n+test_expect_success '#0: at root' '\n+\tcat >0/expected <<EOF && test_repo 0\n+.git\n+$TRASH_DIRECTORY/0\n+$TRASH_DIRECTORY/0\n+EOF\n+'\n+\n+test_expect_success '#0: in subdir' '\n+\tcat >0/sub/expected <<EOF && test_repo 0/sub\n+.git\n+$TRASH_DIRECTORY/0\n+$TRASH_DIRECTORY/0\n+sub/\n+EOF\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154316","messageId":"1287922310-14678-5-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 04/18] t1510: setup case #1","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:36Z","receivedAt":"2010-10-24T12:11:36Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   42 ++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 42 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 88edf4d..d450b4a 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -97,4 +97,46 @@ sub/\n EOF\n '\n \n+#\n+# case #1\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is not set\n+#  - core.worktree is not set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output: same as case #0 (with warnings perhaps)\n+\n+test_expect_success '#1: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 1 1/sub 1.wt 1.wt/sub 1/wt 1/wt/sub &&\n+\tcd 1 && git init && cd ..\n+'\n+\n+# FIXME: check for warning that GIT_WORK_TREE is ignored\n+test_expect_failure '#1: at root' '\n+\tcat >1/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/1\n+$TRASH_DIRECTORY/1\n+EOF\n+\tGIT_WORK_TREE=non-existent test_repo 1\n+'\n+\n+# FIXME: check for warning that GIT_WORK_TREE is ignored\n+test_expect_failure '#1: in subdir' '\n+\tcat >1/sub/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/1\n+$TRASH_DIRECTORY/1\n+sub/\n+EOF\n+\tGIT_WORK_TREE=non-existent test_repo 1/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154318","messageId":"1287922310-14678-6-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 05/18] t1510: setup case #2","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:37Z","receivedAt":"2010-10-24T12:11:37Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   63 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 63 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex d450b4a..20ad6d4 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -139,4 +139,67 @@ EOF\n \tGIT_WORK_TREE=non-existent test_repo 1/sub\n '\n \n+#\n+# case #2\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is set\n+#  - core.worktree is not set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+#  - worktree is at original cwd\n+#  - cwd is unchanged\n+#  - prefix is NULL\n+#  - git_dir is set to $GIT_DIR\n+#  - cwd can't be outside worktree\n+\n+test_expect_success '#2: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 2 2/sub &&\n+\tcd 2 && git init && cd ..\n+'\n+\n+test_expect_success '#2: at root' '\n+\tcat >2/expected <<EOF &&\n+$TRASH_DIRECTORY/2/.git\n+$TRASH_DIRECTORY/2\n+$TRASH_DIRECTORY/2\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/2/.git\" test_repo 2\n+'\n+\n+test_expect_success '#2: in subdir' '\n+\tcat >2/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/2/.git\n+$TRASH_DIRECTORY/2/sub\n+$TRASH_DIRECTORY/2/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/2/.git\" test_repo 2/sub\n+'\n+\n+test_expect_success '#2: relative GIT_DIR at root' '\n+\tcat >2/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/2\n+$TRASH_DIRECTORY/2\n+EOF\n+\tGIT_DIR=.git test_repo 2\n+'\n+\n+test_expect_success '#2: relative GIT_DIR in subdir' '\n+\tcat >2/sub/expected <<EOF &&\n+../.git\n+$TRASH_DIRECTORY/2/sub\n+$TRASH_DIRECTORY/2/sub\n+EOF\n+\tGIT_DIR=../.git test_repo 2/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154319","messageId":"1287922310-14678-7-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 06/18] t1510: setup case #3","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:38Z","receivedAt":"2010-10-24T12:11:38Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  255 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 255 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 20ad6d4..508b7e2 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -202,4 +202,259 @@ EOF\n \tGIT_DIR=../.git test_repo 2/sub\n '\n \n+#\n+# case #3\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is set\n+#  - core.worktree is not set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+#  - worktree is set to $GIT_WORK_TREE\n+#  - cwd is at worktree root\n+#  - prefix is calculated\n+#  - git_dir is set to $GIT_DIR\n+#  - cwd can be outside worktree\n+\n+test_expect_success '#3: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 3 3/sub 3/sub/sub 3.wt 3.wt/sub 3/wt 3/wt/sub &&\n+\tcd 3 && git init && cd ..\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE at root' '\n+\tcat >3/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/3\" test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/3\" test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=. test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORKTREE in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/3\" test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORKTREE in subdir' '\n+\tcat >3/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/3\" test_repo 3/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORKTREE(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3\n+$TRASH_DIRECTORY/3\n+sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=../.. test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >3/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/3/wt\" test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=wt test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/3/wt\" test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/3/wt\" test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=../../wt test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY/3/wt\n+$TRASH_DIRECTORY/3/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/3/wt\" test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=.. test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >3/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=../../../ test_repo 3/sub/sub\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/3/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+3/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 3/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154320","messageId":"1287922310-14678-8-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 07/18] t1510: setup case #4","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:39Z","receivedAt":"2010-10-24T12:11:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  131 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 131 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 508b7e2..ee2b02a 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -457,4 +457,135 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/3/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 3/sub/sub\n '\n \n+#\n+# case #4\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is not set\n+#  - core.worktree is set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+#  - worktree is at core.worktree\n+#  - cwd is at worktree root\n+#  - prefix is calculated\n+#  - git_dir is discovered\n+#  - cwd can be outside worktree\n+\n+test_expect_success '#4: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 4 4/sub 4/sub/sub 4.wt 4.wt/sub 4/wt 4/wt/sub &&\n+\tcd 4 && git init && cd ..\n+'\n+\n+test_expect_success '#4: core.worktree(rel), at root' '\n+\tcat >4/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/4\n+$TRASH_DIRECTORY/4\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree .. &&\n+\ttest_repo 4\n+'\n+\n+test_expect_success '#4: core.worktree, at root' '\n+\tcat >4/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/4\n+$TRASH_DIRECTORY/4\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree \"$TRASH_DIRECTORY/4\" &&\n+\ttest_repo 4\n+'\n+\n+test_expect_failure '#4: core.worktree(rel), in subdir' '\n+\tcat >4/sub/sub/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/4\n+$TRASH_DIRECTORY/4\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree .. &&\n+\ttest_repo 4/sub/sub\n+'\n+\n+test_expect_success '#4: core.worktree, in subdir' '\n+\tcat >4/sub/sub/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/4\n+$TRASH_DIRECTORY/4\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree \"$TRASH_DIRECTORY/4\" &&\n+\ttest_repo 4/sub/sub\n+'\n+\n+test_expect_success '#4: core.worktree=wt(rel), at root' '\n+\tcat >4/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/4/wt\n+$TRASH_DIRECTORY/4\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree ../wt &&\n+\ttest_repo 4\n+'\n+\n+test_expect_success '#4: core.worktree=wt, at root' '\n+\tcat >4/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/4/wt\n+$TRASH_DIRECTORY/4\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree \"$TRASH_DIRECTORY/4/wt\" &&\n+\ttest_repo 4\n+'\n+\n+test_expect_failure '#4: core.worktree=wt(rel), in subdir' '\n+\tcat >4/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/4/wt\n+$TRASH_DIRECTORY/4/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree ../wt &&\n+\ttest_repo 4/sub/sub\n+'\n+\n+test_expect_failure '#4: core.worktree=wt, in subdir' '\n+\tcat >4/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/4/wt\n+$TRASH_DIRECTORY/4/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree \"$TRASH_DIRECTORY/4/wt\" &&\n+\ttest_repo 4/sub/sub\n+'\n+\n+test_expect_failure '#4: core.worktree=..(rel), at root' '\n+\tcat >4/expected <<EOF &&\n+4/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+4/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree ../.. &&\n+\ttest_repo 4\n+'\n+\n+test_expect_failure '#4: core.worktree=.., at root' '\n+\tcat >4/expected <<EOF &&\n+4/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+4/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/4/.git/config\" core.worktree \"$TRASH_DIRECTORY/4\" &&\n+\ttest_repo 4\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154321","messageId":"1287922310-14678-9-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 08/18] t1510: setup case #5","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:40Z","receivedAt":"2010-10-24T12:11:40Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  135 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 135 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex ee2b02a..87db2c6 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -588,4 +588,139 @@ EOF\n \ttest_repo 4\n '\n \n+#\n+# case #5\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is not set\n+#  - core.worktree is set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# GIT_WORK_TREE is only effective when GIT_DIR is\n+# set, which is not the case. So it is the same as case #4.\n+#\n+#  - worktree is at core.worktree\n+#  - cwd is at worktree root\n+#  - prefix is calculated\n+#  - git_dir is discovered\n+#  - cwd can be outside worktree\n+\n+test_expect_success '#5: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 5 5/sub 5/sub/sub 5.wt 5.wt/sub 5/wt 5/wt/sub &&\n+\tcd 5 && git init && cd .. &&\n+\texport GIT_WORK_TREE=non-existent\n+'\n+\n+test_expect_failure '#5: core.worktree(rel), at root' '\n+\tcat >5/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/5\n+$TRASH_DIRECTORY/5\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree .. &&\n+\ttest_repo 5\n+'\n+\n+test_expect_failure '#5: core.worktree, at root' '\n+\tcat >5/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/5\n+$TRASH_DIRECTORY/5\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree \"$TRASH_DIRECTORY/5\" &&\n+\ttest_repo 5\n+'\n+\n+test_expect_failure '#5: core.worktree(rel), in subdir' '\n+\tcat >5/sub/sub/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/5\n+$TRASH_DIRECTORY/5\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree .. &&\n+\ttest_repo 5/sub/sub\n+'\n+\n+test_expect_failure '#5: core.worktree, in subdir' '\n+\tcat >5/sub/sub/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/5\n+$TRASH_DIRECTORY/5\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree \"$TRASH_DIRECTORY/5\" &&\n+\ttest_repo 5/sub/sub\n+'\n+\n+test_expect_failure '#5: core.worktree=wt(rel), at root' '\n+\tcat >5/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/5/wt\n+$TRASH_DIRECTORY/5\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree ../wt &&\n+\ttest_repo 5\n+'\n+\n+test_expect_failure '#5: core.worktree=wt, at root' '\n+\tcat >5/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/5/wt\n+$TRASH_DIRECTORY/5\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree \"$TRASH_DIRECTORY/5/wt\" &&\n+\ttest_repo 5\n+'\n+\n+test_expect_failure '#5: core.worktree=wt(rel), in subdir' '\n+\tcat >5/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/5/wt\n+$TRASH_DIRECTORY/5/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree ../wt &&\n+\ttest_repo 5/sub/sub\n+'\n+\n+test_expect_failure '#5: core.worktree=wt, in subdir' '\n+\tcat >5/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/5/wt\n+$TRASH_DIRECTORY/5/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree \"$TRASH_DIRECTORY/5/wt\" &&\n+\ttest_repo 5/sub/sub\n+'\n+\n+test_expect_failure '#5: core.worktree=..(rel), at root' '\n+\tcat >5/expected <<EOF &&\n+5/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+5/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree ../.. &&\n+\ttest_repo 5\n+'\n+\n+test_expect_failure '#5: core.worktree=.., at root' '\n+\tcat >5/expected <<EOF &&\n+5/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+5/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/5/.git/config\" core.worktree \"$TRASH_DIRECTORY/5\" &&\n+\ttest_repo 5\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154323","messageId":"1287922310-14678-10-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 09/18] t1510: setup case #6","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:41Z","receivedAt":"2010-10-24T12:11:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  279 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 279 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 87db2c6..7e902b0 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -723,4 +723,283 @@ EOF\n \ttest_repo 5\n '\n \n+#\n+# case #6\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is set\n+#  - core.worktree is set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+#  - worktree is at core.worktree\n+#  - cwd is at worktree root\n+#  - prefix is calculated\n+#  - git_dir is at $GIT_DIR\n+#  - cwd can be outside worktree\n+\n+test_expect_success '#6: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 6 6/sub 6/sub/sub 6.wt 6.wt/sub 6/wt 6/wt/sub &&\n+\tcd 6 && git init && cd ..\n+'\n+\n+test_expect_success '#6: GIT_DIR(rel), GIT_WORK_TREE at root' '\n+\tcat >6/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6\" &&\n+\tGIT_DIR=.git test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR(rel), GIT_WORK_TREE(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree .. &&\n+\tGIT_DIR=.git test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE at root' '\n+\tcat >6/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree .. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n+'\n+\n+test_expect_failure '#6: GIT_DIR(rel), GIT_WORKTREE in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6\" &&\n+\tGIT_DIR=../../.git test_repo 6/sub/sub\n+'\n+\n+test_expect_failure '#6: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree .. &&\n+\tGIT_DIR=../../.git test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORKTREE in subdir' '\n+\tcat >6/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORKTREE(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6\n+$TRASH_DIRECTORY/6\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree .. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >6/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6/wt\" &&\n+\tGIT_DIR=.git test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=.git test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >6/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6/wt\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6/wt\" &&\n+\tGIT_DIR=../../.git test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=../../.git test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY/6/wt\n+$TRASH_DIRECTORY/6/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY/6/wt\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n+'\n+\n+test_expect_failure '#6: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >6/expected <<EOF &&\n+6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=.git test_repo 6\n+'\n+\n+test_expect_failure '#6: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../../ &&\n+\tGIT_DIR=.git test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../../ &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >6/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n+'\n+\n+test_expect_failure '#6: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=../../.git test_repo 6/sub/sub\n+'\n+\n+test_expect_failure '#6: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../.. &&\n+\tGIT_DIR=../../.git test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree ../.. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n+'\n+\n+test_expect_success '#6: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/6/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+6/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/6/.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154322","messageId":"1287922310-14678-11-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 10/18] t1510: setup case #7","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:42Z","receivedAt":"2010-10-24T12:11:42Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  261 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 261 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 7e902b0..2f36bfe 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1002,4 +1002,265 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n '\n \n+#\n+# case #7\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is set\n+#  - core.worktree is set\n+#  - .git is a directory\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# core.worktree is overridden by GIT_WORK_TREE, so this is the same as\n+# case #3.\n+#\n+#  - worktree is at $GIT_WORK_TREE\n+#  - cwd is at worktree root\n+#  - prefix is calculated\n+#  - git_dir is at $GIT_DIR\n+#  - cwd can be outside worktree\n+\n+test_expect_success '#7: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 7 7/sub 7/sub/sub 7.wt 7.wt/sub 7/wt 7/wt/sub &&\n+\tcd 7 &&\n+\tgit init &&\n+\tgit config core.worktree non-existent &&\n+\tcd ..\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE at root' '\n+\tcat >7/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/7\" test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/7\" test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=. test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORKTREE in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/7\" test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORKTREE in subdir' '\n+\tcat >7/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/7\" test_repo 7/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORKTREE(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7\n+$TRASH_DIRECTORY/7\n+sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=../.. test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >7/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/7/wt\" test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=wt test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/7/wt\" test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/7/wt\" test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=../../wt test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY/7/wt\n+$TRASH_DIRECTORY/7/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/7/wt\" test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=.. test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >7/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=../../../ test_repo 7/sub/sub\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/7/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+7/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 7/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154324","messageId":"1287922310-14678-12-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 11/18] t1510: setup case #8","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:43Z","receivedAt":"2010-10-24T12:11:43Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   52 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 52 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 2f36bfe..c77c245 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1263,4 +1263,56 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/7/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 7/sub/sub\n '\n \n+#\n+# case #8\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is not set\n+#  - core.worktree is not set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #1 except that git_dir is set by .git file\n+#\n+#  - worktree is at .git file's parent directory\n+#  - cwd is at worktree root\n+#  - prefix is calculated\n+#  - git_dir is set to where .git points to\n+#  - cwd can't be outside worktree\n+\n+test_expect_success '#8: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 8 8/sub &&\n+\tcd 8 &&\n+\tgit init &&\n+\tmv .git ../8.git &&\n+\techo gitdir: ../8.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_success '#8: at root' '\n+\tcat >8/expected <<EOF &&\n+$TRASH_DIRECTORY/8.git\n+$TRASH_DIRECTORY/8\n+$TRASH_DIRECTORY/8\n+EOF\n+\ttest_repo 8\n+'\n+\n+test_expect_success '#8: in subdir' '\n+\tcat >8/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/8.git\n+$TRASH_DIRECTORY/8\n+$TRASH_DIRECTORY/8\n+sub/\n+EOF\n+\ttest_repo 8/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154325","messageId":"1287922310-14678-13-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 12/18] t1510: setup case #9","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:44Z","receivedAt":"2010-10-24T12:11:44Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   48 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 48 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex c77c245..c516155 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1315,4 +1315,52 @@ EOF\n \ttest_repo 8/sub\n '\n \n+#\n+# case #9\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is not set\n+#  - core.worktree is not set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #1 except that git_dir is set by .git file\n+\n+test_expect_success '#9: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 9 9/sub 9.wt 9.wt/sub 9/wt 9/wt/sub &&\n+\tcd 9 &&\n+\tgit init &&\n+\tmv .git ../9.git &&\n+\techo gitdir: ../9.git >.git &&\n+\tcd ..\n+'\n+\n+# FIXME: check for warning that GIT_WORK_TREE is ignored\n+test_expect_failure '#9: at root' '\n+\tcat >9/expected <<EOF &&\n+$TRASH_DIRECTORY/9.git\n+$TRASH_DIRECTORY/9\n+$TRASH_DIRECTORY/9\n+EOF\n+\tGIT_WORK_TREE=non-existent test_repo 9\n+'\n+\n+# FIXME: check for warning that GIT_WORK_TREE is ignored\n+test_expect_failure '#9: in subdir' '\n+\tcat >9/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/9.git\n+$TRASH_DIRECTORY/9\n+$TRASH_DIRECTORY/9\n+sub/\n+EOF\n+\tGIT_WORK_TREE=non-existent test_repo 9/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154326","messageId":"1287922310-14678-14-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 13/18] t1510: setup case #10","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:45Z","receivedAt":"2010-10-24T12:11:45Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |   63 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 63 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex c516155..31bacd7 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1363,4 +1363,67 @@ EOF\n \tGIT_WORK_TREE=non-existent test_repo 9/sub\n '\n \n+#\n+# case #10\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is set\n+#  - core.worktree is not set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #2 except that git_dir is set by .git file\n+\n+test_expect_success '#10: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 10 10/sub &&\n+\tcd 10 &&\n+\tgit init &&\n+\tmv .git ../10.git &&\n+\techo gitdir: ../10.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#10: at root' '\n+\tcat >10/expected <<EOF &&\n+$TRASH_DIRECTORY/10.git\n+$TRASH_DIRECTORY/10\n+$TRASH_DIRECTORY/10\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/10/.git\" test_repo 10\n+'\n+\n+test_expect_failure '#10: in subdir' '\n+\tcat >10/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/10.git\n+$TRASH_DIRECTORY/10/sub\n+$TRASH_DIRECTORY/10/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/10/.git\" test_repo 10/sub\n+'\n+\n+test_expect_failure '#10: relative GIT_DIR at root' '\n+\tcat >10/expected <<EOF &&\n+$TRASH_DIRECTORY/10.git\n+$TRASH_DIRECTORY/10\n+$TRASH_DIRECTORY/10\n+EOF\n+\tGIT_DIR=.git test_repo 10\n+'\n+\n+test_expect_failure '#10: relative GIT_DIR in subdir' '\n+\tcat >10/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/10.git\n+$TRASH_DIRECTORY/10/sub\n+$TRASH_DIRECTORY/10/sub\n+EOF\n+\tGIT_DIR=../.git test_repo 10/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154327","messageId":"1287922310-14678-15-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 14/18] t1510: setup case #11","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:46Z","receivedAt":"2010-10-24T12:11:46Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  255 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 255 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 31bacd7..f8ab969 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1426,4 +1426,259 @@ EOF\n \tGIT_DIR=../.git test_repo 10/sub\n '\n \n+#\n+# case #11\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is set\n+#  - core.worktree is not set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #3 except that git_dir is set by .git file\n+\n+test_expect_success '#11: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 11 11/sub 11/sub/sub 11.wt 11.wt/sub 11/wt 11/wt/sub &&\n+\tcd 11 &&\n+\tgit init &&\n+\tmv .git ../11.git &&\n+\techo gitdir: ../11.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=. test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORKTREE in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORKTREE in subdir' '\n+\tcat >11/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORKTREE(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11\n+$TRASH_DIRECTORY/11\n+sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=../.. test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=wt test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=../../wt test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY/11/wt\n+$TRASH_DIRECTORY/11/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=.. test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >11/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=../../../ test_repo 11/sub/sub\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/11.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+11/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154328","messageId":"1287922310-14678-16-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 15/18] t1510: setup case #12","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:47Z","receivedAt":"2010-10-24T12:11:47Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  132 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 132 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex f8ab969..1516ff6 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1681,4 +1681,136 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11/sub/sub\n '\n \n+#\n+# case #12\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is not set\n+#  - core.worktree is set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #4 except that git_dir is set by .git file\n+\n+\n+test_expect_success '#12: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 12 12/sub 12/sub/sub 12.wt 12.wt/sub 12/wt 12/wt/sub &&\n+\tcd 12 &&\n+\tgit init &&\n+\tmv .git ../12.git &&\n+\techo gitdir: ../12.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#12: core.worktree(rel), at root' '\n+\tcat >12/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12\n+$TRASH_DIRECTORY/12\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree .. &&\n+\ttest_repo 12\n+'\n+\n+test_expect_success '#12: core.worktree, at root' '\n+\tcat >12/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12\n+$TRASH_DIRECTORY/12\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree \"$TRASH_DIRECTORY/12\" &&\n+\ttest_repo 12\n+'\n+\n+test_expect_failure '#12: core.worktree(rel), in subdir' '\n+\tcat >12/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12\n+$TRASH_DIRECTORY/12\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree .. &&\n+\ttest_repo 12/sub/sub\n+'\n+\n+test_expect_success '#12: core.worktree, in subdir' '\n+\tcat >12/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12\n+$TRASH_DIRECTORY/12\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree \"$TRASH_DIRECTORY/12\" &&\n+\ttest_repo 12/sub/sub\n+'\n+\n+test_expect_failure '#12: core.worktree=wt(rel), at root' '\n+\tcat >12/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12/wt\n+$TRASH_DIRECTORY/12\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree ../wt &&\n+\ttest_repo 12\n+'\n+\n+test_expect_success '#12: core.worktree=wt, at root' '\n+\tcat >12/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12/wt\n+$TRASH_DIRECTORY/12\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree \"$TRASH_DIRECTORY/12/wt\" &&\n+\ttest_repo 12\n+'\n+\n+test_expect_failure '#12: core.worktree=wt(rel), in subdir' '\n+\tcat >12/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12/wt\n+$TRASH_DIRECTORY/12/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree ../wt &&\n+\ttest_repo 12/sub/sub\n+'\n+\n+test_expect_success '#12: core.worktree=wt, in subdir' '\n+\tcat >12/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY/12/wt\n+$TRASH_DIRECTORY/12/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree \"$TRASH_DIRECTORY/12/wt\" &&\n+\ttest_repo 12/sub/sub\n+'\n+\n+test_expect_failure '#12: core.worktree=..(rel), at root' '\n+\tcat >12/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+12/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree ../.. &&\n+\ttest_repo 12\n+'\n+\n+test_expect_failure '#12: core.worktree=.., at root' '\n+\tcat >12/expected <<EOF &&\n+$TRASH_DIRECTORY/12.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+12/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/12.git/config\" core.worktree \"$TRASH_DIRECTORY/12\" &&\n+\ttest_repo 12\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154329","messageId":"1287922310-14678-17-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 16/18] t1510: setup case #13","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:48Z","receivedAt":"2010-10-24T12:11:48Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  132 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 132 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 1516ff6..2a69a78 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1813,4 +1813,136 @@ EOF\n \ttest_repo 12\n '\n \n+#\n+# case #13\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is not set\n+#  - core.worktree is set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #5 except that git_dir is set by .git file\n+\n+test_expect_success '#13: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 13 13/sub 13/sub/sub 13.wt 13.wt/sub 13/wt 13/wt/sub &&\n+\tcd 13 &&\n+\tgit init &&\n+\tmv .git ../13.git &&\n+\techo gitdir: ../13.git >.git &&\n+\tcd .. &&\n+\texport GIT_WORK_TREE=non-existent\n+'\n+\n+test_expect_failure '#13: core.worktree(rel), at root' '\n+\tcat >13/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13\n+$TRASH_DIRECTORY/13\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree .. &&\n+\ttest_repo 13\n+'\n+\n+test_expect_failure '#13: core.worktree, at root' '\n+\tcat >13/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13\n+$TRASH_DIRECTORY/13\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree \"$TRASH_DIRECTORY/13\" &&\n+\ttest_repo 13\n+'\n+\n+test_expect_failure '#13: core.worktree(rel), in subdir' '\n+\tcat >13/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13\n+$TRASH_DIRECTORY/13\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree .. &&\n+\ttest_repo 13/sub/sub\n+'\n+\n+test_expect_failure '#13: core.worktree, in subdir' '\n+\tcat >13/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13\n+$TRASH_DIRECTORY/13\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree \"$TRASH_DIRECTORY/13\" &&\n+\ttest_repo 13/sub/sub\n+'\n+\n+test_expect_failure '#13: core.worktree=wt(rel), at root' '\n+\tcat >13/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13/wt\n+$TRASH_DIRECTORY/13\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree ../wt &&\n+\ttest_repo 13\n+'\n+\n+test_expect_failure '#13: core.worktree=wt, at root' '\n+\tcat >13/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13/wt\n+$TRASH_DIRECTORY/13\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree \"$TRASH_DIRECTORY/13/wt\" &&\n+\ttest_repo 13\n+'\n+\n+test_expect_failure '#13: core.worktree=wt(rel), in subdir' '\n+\tcat >13/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13/wt\n+$TRASH_DIRECTORY/13/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree ../wt &&\n+\ttest_repo 13/sub/sub\n+'\n+\n+test_expect_failure '#13: core.worktree=wt, in subdir' '\n+\tcat >13/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY/13/wt\n+$TRASH_DIRECTORY/13/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree \"$TRASH_DIRECTORY/13/wt\" &&\n+\ttest_repo 13/sub/sub\n+'\n+\n+test_expect_failure '#13: core.worktree=..(rel), at root' '\n+\tcat >13/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+13/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree ../.. &&\n+\ttest_repo 13\n+'\n+\n+test_expect_failure '#13: core.worktree=.., at root' '\n+\tcat >13/expected <<EOF &&\n+$TRASH_DIRECTORY/13.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+13/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/13.git/config\" core.worktree \"$TRASH_DIRECTORY/13\" &&\n+\ttest_repo 13\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154330","messageId":"1287922310-14678-18-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 17/18] t1510: setup case #14","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:49Z","receivedAt":"2010-10-24T12:11:49Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  279 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 279 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 2a69a78..5c1b96e 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1945,4 +1945,283 @@ EOF\n \ttest_repo 13\n '\n \n+#\n+# case #14\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is not set\n+#  - GIT_DIR is set\n+#  - core.worktree is set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #6 except that git_dir is set by .git file\n+\n+test_expect_success '#14: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 14 14/sub 14/sub/sub 14.wt 14.wt/sub 14/wt 14/wt/sub &&\n+\tcd 14 &&\n+\tgit init &&\n+\tmv .git ../14.git &&\n+\techo gitdir: ../14.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE at root' '\n+\tcat >14/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14\" &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree .. &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE at root' '\n+\tcat >14/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree .. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORKTREE in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14\" &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree .. &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORKTREE in subdir' '\n+\tcat >14/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORKTREE(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14\n+$TRASH_DIRECTORY/14\n+sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree .. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >14/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14/wt\" &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >14/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14/wt\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14/wt\" &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+../../.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY/14/wt\n+$TRASH_DIRECTORY/14/sub/sub\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY/14/wt\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >14/expected <<EOF &&\n+14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../../ &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../../ &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >14/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../.. &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../.. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/14/.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+14/sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree \"$TRASH_DIRECTORY\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154331","messageId":"1287922310-14678-19-git-send-email-pclouds@gmail.com","threadId":"25538","inReplyTo":"1287922310-14678-1-git-send-email-pclouds@gmail.com","subject":"[WIP PATCH 18/18] t1510: setup case #15","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-24T12:11:50Z","receivedAt":"2010-10-24T12:11:50Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"---\n t/t1510-repo-setup.sh |  256 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 256 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 5c1b96e..f412890 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2224,4 +2224,260 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n+#\n+# case #15\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is set\n+#  - core.worktree is set\n+#  - .git is a file\n+#  - core.bare is not set, cwd is outside .git\n+#\n+# Output:\n+#\n+# same as case #7 except that git_dir is set by .git file\n+\n+test_expect_success '#15: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 15 15/sub 15/sub/sub 15.wt 15.wt/sub 15/wt 15/wt/sub &&\n+\tcd 15 &&\n+\tgit init &&\n+\tgit config core.worktree non-existent &&\n+\tmv .git ../15.git &&\n+\techo gitdir: ../15.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=. test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORKTREE in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORKTREE in subdir' '\n+\tcat >15/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORKTREE(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15\n+$TRASH_DIRECTORY/15\n+sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=../.. test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=wt test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15/sub/sub\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=../../wt test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY/15/wt\n+$TRASH_DIRECTORY/15/sub/sub\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=.. test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >15/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=../../../ test_repo 15/sub/sub\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+$TRASH_DIRECTORY/15.git\n+$TRASH_DIRECTORY\n+$TRASH_DIRECTORY\n+15/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154337","messageId":"20101024154005.GB31764@burratino","threadId":"25538","inReplyTo":"1287922310-14678-2-git-send-email-pclouds@gmail.com","subject":"Re: [WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-10-24T15:40:05Z","receivedAt":"2010-10-24T15:40:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyễn Thái Ngọc Duy wrote:\n\n> --internal-cwd is obvious, no way else to expose it for testing.\n>\n> --internal-git-dir is introduced because --git-dir prepares its output\n> suitable for scripting. For tests, it must be exactly what git stores.\n\nHmm.  Forget this is used in tests, would it make sense to do this\nwith trace_printf, at the end of setup, as in your earlier patch?\n\nI think it might: just like the exec: lines provide context about what\ncommand is being traced, such trace: cwd: lines would make it clearer\nwhat paths that are being output might be referring to.\n\nReturning to the topic of tests, is it possible to get at these\nvariables using an external command that is run by git?  pre-commit\nhook, maybe.  Testing of other symptoms is also possible, as in\nFrédéric's example.\n"},{"id":"154353","messageId":"AANLkTimfDVPFK7y-bkg-QYsTyHKdoxmvZxzzt36w95r5@mail.gmail.com","threadId":"25538","inReplyTo":"20101024154005.GB31764@burratino","subject":"Re: [WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-25T00:04:00Z","receivedAt":"2010-10-25T00:04:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2010/10/24 Jonathan Nieder <jrnieder@gmail.com>:\n> Nguyễn Thái Ngọc Duy wrote:\n>\n>> --internal-cwd is obvious, no way else to expose it for testing.\n>>\n>> --internal-git-dir is introduced because --git-dir prepares its output\n>> suitable for scripting. For tests, it must be exactly what git stores.\n>\n> Hmm.  Forget this is used in tests, would it make sense to do this\n> with trace_printf, at the end of setup, as in your earlier patch?\n\ntrace_printf surely does. But \"the end of setup\" is unclear. As of\nnow, setup ends when setup_* function _and_ setup_git_env() are\ncalled. There are cases that setup_* finishes without calling\nsetup_git_env(), or setup_git_env() is called way before setup_* is\nfinished.\n\n> I think it might: just like the exec: lines provide context about what\n> command is being traced, such trace: cwd: lines would make it clearer\n> what paths that are being output might be referring to.\n\nAlso prefix them all with \"setup:\", something like\n\nsetup: git_dir: ../.git\nsetup: work_tree: /my/git/worktree\nsetup: cwd: /my/git/worktree\nsetup: prefix: sub/\n\nwould be easy to be grepped from GIT_TRACE, to read and to test_cmp.\n\n> Returning to the topic of tests, is it possible to get at these\n> variables using an external command that is run by git?  pre-commit\n> hook, maybe.  Testing of other symptoms is also possible, as in\n> Frédéric's example.\n\nWhy do hooks need these? git_dir, prefix are already accessible via\n--git-dir, --show-prefix, --show-toplevel. Current cwd can be\ndetermined with --is-inside-work-tree: if it returns true, current cwd\nis worktree root, otherwise it is original cwd.\n-- \nDuy\n"},{"id":"154394","messageId":"m339ruk284.fsf@localhost.localdomain","threadId":"25538","inReplyTo":"AANLkTimfDVPFK7y-bkg-QYsTyHKdoxmvZxzzt36w95r5@mail.gmail.com","subject":"Re: [WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-10-25T10:15:58Z","receivedAt":"2010-10-25T10:15:58Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> 2010/10/24 Jonathan Nieder <jrnieder@gmail.com>:\n\n> > I think it might: just like the exec: lines provide context about what\n> > command is being traced, such trace: cwd: lines would make it clearer\n> > what paths that are being output might be referring to.\n> \n> Also prefix them all with \"setup:\", something like\n> \n> setup: git_dir: ../.git\n> setup: work_tree: /my/git/worktree\n> setup: cwd: /my/git/worktree\n> setup: prefix: sub/\n\nI guess that those paths would be c-quoted, if necessary (trailing\nspace, embedded newline, quotes, etc.)?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"154396","messageId":"AANLkTikm+JxyXk_bVXKaX_0aaSfqjrXU=m946Nm0=1vV@mail.gmail.com","threadId":"25538","inReplyTo":"m339ruk284.fsf@localhost.localdomain","subject":"Re: [WIP PATCH 01/18] rev-parse: add --internal-cwd and --internal-git-dir for tests","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-25T10:30:33Z","receivedAt":"2010-10-25T10:30:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Oct 25, 2010 at 5:15 PM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n>\n>> 2010/10/24 Jonathan Nieder <jrnieder@gmail.com>:\n>\n>> > I think it might: just like the exec: lines provide context about what\n>> > command is being traced, such trace: cwd: lines would make it clearer\n>> > what paths that are being output might be referring to.\n>>\n>> Also prefix them all with \"setup:\", something like\n>>\n>> setup: git_dir: ../.git\n>> setup: work_tree: /my/git/worktree\n>> setup: cwd: /my/git/worktree\n>> setup: prefix: sub/\n>\n> I guess that those paths would be c-quoted, if necessary (trailing\n> space, embedded newline, quotes, etc.)?\n\nFor the sake of grep (because '\\n' may break lines), yes.\n-- \nDuy\n"}]}