{"thread":{"id":"25587","subject":"[PATCH 00/42] repo setup test cases and fixes","startedAt":"2010-10-29T06:48:12Z","lastAt":"2010-11-01T06:26:34Z","messageCount":60,"participants":["Nguyễn Thái Ngọc Duy","Nguyen Thai Ngoc Duy","Sverre Rabbelier","Jonathan Nieder"],"isPatch":true,"patchVersion":1,"patchTotal":42},"messages":[{"id":"154719","messageId":"1288334934-17216-1-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":null,"subject":"[PATCH 00/42] repo setup test cases and fixes","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:12Z","receivedAt":"2010-10-29T06:48:12Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"I hope this is the last time setup_* functions need to be fixed. There\nis still room for improvement though. Two comes to mind are:\n\n - warn users when GIT_WORK_TREE/core.worktree/core.bare is set but\n   ignored\n - turn absolute path to relative where possible\n\nThis series includes setup coverage tests (180/376 fail). Then the fixes,\nwhich bring down to zero failed test in the end. 02/42 describes the\nrules. New rules are:\n\n - GIT_WORK_TREE is relative to user's cwd. This is how the code works\n   until now (which also makes sense to me).\n\n - core.worktree won't override core.bare.\n\nDocuments may need updates. I'll do that later.\n\n\nNguyễn Thái Ngọc Duy (42):\n  builtins: print setup info if repo is found\n  Add t1510 and basic rules that run repo setup\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  t1510: setup case #16\n  t1510: setup case #17\n  t1510: setup case #18\n  t1510: setup case #19\n  t1510: setup case #20\n  t1510: setup case #21\n  t1510: setup case #22\n  t1510: setup case #23\n  t1510: setup case #24\n  t1510: setup case #25\n  t1510: setup case #26\n  t1510: setup case #27\n  t1510: setup case #28\n  t1510: setup case #29\n  t1510: setup case #30\n  t1510: setup case #31\n\nTests\n\n\n  rev-parse: prints --git-dir relative to user's cwd\n\nIndepdent fix, but is needed after setup_* rework because the new code\nwill set relative git_dir.\n\n\n  Add git_config_early()\n  Use git_config_early() instead of git_config() during repo setup\n\nCherry-picked from my old tp/setup series, needed to be able to check\ncore.{bare,worktree} early.\n\n\n  Remove all logic from get_git_work_tree()\n\nBreak it some more.\n\n\n  setup: clean up setup_bare_git_dir()\n  setup: clean up setup_discovered_git_dir()\n  setup: rework setup_explicit_git_dir()\n\nsetup_* rework.\n\n  t1510: all failed tests are now fixed\n\nAll tests are passed.\n\n\n builtin/init-db.c     |   13 +-\n builtin/rev-parse.c   |    6 +-\n cache.h               |    2 +\n config.c              |   19 +-\n environment.c         |   21 +-\n git.c                 |    4 +\n setup.c               |  227 ++-\n t/t1510-repo-setup.sh | 4515 +++++++++++++++++++++++++++++++++++++++++++++++++\n trace.c               |   42 +\n 9 files changed, 4733 insertions(+), 116 deletions(-)\n create mode 100755 t/t1510-repo-setup.sh\n"},{"id":"154720","messageId":"1288334934-17216-2-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 01/42] builtins: print setup info if repo is found","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:13Z","receivedAt":"2010-10-29T06:48:13Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n cache.h |    1 +\n git.c   |    4 ++++\n trace.c |   42 ++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 47 insertions(+), 0 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 33decd9..d1bee5d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1062,6 +1062,7 @@ __attribute__((format (printf, 1, 2)))\n extern void trace_printf(const char *format, ...);\n __attribute__((format (printf, 2, 3)))\n extern void trace_argv_printf(const char **argv, const char *format, ...);\n+extern void trace_repo_setup(const char *prefix);\n \n /* convert.c */\n /* returns 1 if *dst was used */\ndiff --git a/git.c b/git.c\nindex 50a1401..75defb3 100644\n--- a/git.c\n+++ b/git.c\n@@ -264,6 +264,10 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)\n \t\t\tuse_pager = check_pager_config(p->cmd);\n \t\tif (use_pager == -1 && p->option & USE_PAGER)\n \t\t\tuse_pager = 1;\n+\n+\t\tif ((p->option & (RUN_SETUP | RUN_SETUP_GENTLY)) &&\n+\t\t    startup_info->have_repository) /* get_git_dir() may set up repo, avoid that */\n+\t\t\ttrace_repo_setup(prefix);\n \t}\n \tcommit_pager_choice();\n \ndiff --git a/trace.c b/trace.c\nindex 1e560cb..bdb5d2f 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -131,3 +131,45 @@ void trace_argv_printf(const char **argv, const char *fmt, ...)\n \tif (need_close)\n \t\tclose(fd);\n }\n+\n+static const char *quote_crnl(const char *path)\n+{\n+\tstatic char new_path[PATH_MAX];\n+\tconst char *p2 = path;\n+\tchar *p1 = new_path;\n+\n+\tif (!path)\n+\t\treturn NULL;\n+\n+\twhile (*p2) {\n+\t\tswitch (*p2) {\n+\t\tcase '\\\\': *p1++ = '\\\\'; *p1++ = '\\\\'; break;\n+\t\tcase '\\n': *p1++ = '\\\\'; *p1++ = 'n'; break;\n+\t\tcase '\\r': *p1++ = '\\\\'; *p1++ = 'r'; break;\n+\t\tdefault:\n+\t\t\t*p1++ = *p2;\n+\t\t}\n+\t\tp2++;\n+\t}\n+\t*p1 = '\\0';\n+\treturn new_path;\n+}\n+\n+/* FIXME: move prefix to startup_info struct and get rid of this arg */\n+void trace_repo_setup(const char *prefix)\n+{\n+\tchar cwd[PATH_MAX];\n+\tchar *trace = getenv(\"GIT_TRACE\");\n+\n+\tif (!trace || !strcmp(trace, \"\") ||\n+\t    !strcmp(trace, \"0\") || !strcasecmp(trace, \"false\"))\n+\t\treturn;\n+\n+\tif (!getcwd(cwd, PATH_MAX))\n+\t\tdie(\"Unable to get current working directory\");\n+\n+\ttrace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n+\ttrace_printf(\"setup: worktree: %s\\n\", quote_crnl(get_git_work_tree()));\n+\ttrace_printf(\"setup: cwd: %s\\n\", quote_crnl(cwd));\n+\ttrace_printf(\"setup: prefix: %s\\n\", quote_crnl(prefix));\n+}\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154721","messageId":"1288334934-17216-3-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 02/42] Add t1510 and basic rules that run repo setup","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:14Z","receivedAt":"2010-10-29T06:48:14Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   59 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 59 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..623807d\n--- /dev/null\n+++ b/t/t1510-repo-setup.sh\n@@ -0,0 +1,59 @@\n+#!/bin/sh\n+\n+test_description='Tests of cwd/prefix/worktree/gitdir setup in all cases'\n+\n+. ./test-lib.sh\n+\n+#\n+# A few rules for repo setup:\n+#\n+# 1. GIT_DIR is relative to user's cwd. --git-dir is equivalent to\n+#    GIT_DIR.\n+#\n+# 2. .git file is relative to parent directory. .git file is basically\n+#    symlink in disguise. The directory where .git file points to will\n+#    become new git_dir.\n+#\n+# 3. core.worktree is relative to git_dir.\n+#\n+# 4. GIT_WORK_TREE is relative to user's cwd. --work-tree is\n+#    equivalent to GIT_WORK_TREE.\n+#\n+# 5. GIT_WORK_TREE/core.worktree is only effective if GIT_DIR is set\n+#    Uneffective worktree settings should be warned.\n+#\n+# 6. Effective GIT_WORK_TREE overrides core.worktree and core.bare\n+#\n+# 7. Effective core.worktree conflicts with core.bare\n+#\n+# 8. If GIT_DIR is set but neither worktree nor bare setting is given,\n+#    original cwd becomes worktree.\n+#\n+# 9. If .git discovery is done inside a repo, the repo becomes a bare\n+#    repo. .git discovery is performed if GIT_DIR is not set.\n+#\n+# 10. If no worktree is available, cwd remains unchanged, prefix is\n+#     NULL.\n+#\n+# 11. When user's cwd is outside worktree, cwd remains unchanged,\n+#     prefix is NULL.\n+#\n+\n+test_repo() {\n+\t(\n+\tif [ -n \"$1\" ]; then cd \"$1\"; fi &&\n+\tif [ -f trace ]; then rm trace; fi &&\n+\tGIT_TRACE=\"`pwd`/trace\" git symbolic-ref HEAD >/dev/null &&\n+\tgrep '^setup: ' trace >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":"154722","messageId":"1288334934-17216-4-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 03/42] t1510: setup case #0","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:15Z","receivedAt":"2010-10-29T06:48:15Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 47 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 623807d..288e8a8 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -56,4 +56,51 @@ 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 &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/0\n+setup: cwd: $TRASH_DIRECTORY/0\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 0\n+'\n+\n+test_expect_success '#0: in subdir' '\n+\tcat >0/sub/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/0\n+setup: cwd: $TRASH_DIRECTORY/0\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 0/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154723","messageId":"1288334934-17216-5-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 04/42] t1510: setup case #1","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:16Z","receivedAt":"2010-10-29T06:48:16Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   46 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 46 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 288e8a8..e5c366d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -103,4 +103,50 @@ EOF\n \ttest_repo 0/sub\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:\n+#\n+# GIT_WORK_TREE is ignored -> #0\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 &&\n+\tgit init &&\n+\texport GIT_WORK_TREE=non-existent &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#1: at root' '\n+\tcat >1/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/1\n+setup: cwd: $TRASH_DIRECTORY/1\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 1\n+'\n+\n+test_expect_failure '#1: in subdir' '\n+\tcat >1/sub/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/1\n+setup: cwd: $TRASH_DIRECTORY/1\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 1/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154724","messageId":"1288334934-17216-6-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 05/42] t1510: setup case #2","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:17Z","receivedAt":"2010-10-29T06:48:17Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   67 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 67 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex e5c366d..9b3ec8f 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -149,4 +149,71 @@ EOF\n \ttest_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+setup: git_dir: $TRASH_DIRECTORY/2/.git\n+setup: worktree: $TRASH_DIRECTORY/2\n+setup: cwd: $TRASH_DIRECTORY/2\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/2/.git\n+setup: worktree: $TRASH_DIRECTORY/2/sub\n+setup: cwd: $TRASH_DIRECTORY/2/sub\n+setup: prefix: (null)\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+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/2\n+setup: cwd: $TRASH_DIRECTORY/2\n+setup: prefix: (null)\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+setup: git_dir: ../.git\n+setup: worktree: $TRASH_DIRECTORY/2/sub\n+setup: cwd: $TRASH_DIRECTORY/2/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../.git test_repo 2/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154725","messageId":"1288334934-17216-7-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 06/42] t1510: setup case #3","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:18Z","receivedAt":"2010-10-29T06:48:18Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  267 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 267 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 9b3ec8f..3a163d0 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -216,4 +216,271 @@ 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=root at root' '\n+\tcat >3/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 3\n+'\n+\n+test_expect_success '#3: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >3/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >3/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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=root in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: 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=root in subdir' '\n+\tcat >3/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >3/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: 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+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3\n+setup: prefix: (null)\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+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY/3/wt\n+setup: cwd: $TRASH_DIRECTORY/3/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/3/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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":"154726","messageId":"1288334934-17216-8-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 07/42] t1510: setup case #4","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:19Z","receivedAt":"2010-10-29T06:48:19Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   46 ++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 46 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 3a163d0..93cc9fb 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -483,4 +483,50 @@ 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+# core.worktree is ignored -> #0\n+\n+test_expect_success '#4: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 4 4/sub &&\n+\tcd 4 &&\n+\tgit init &&\n+\tgit config core.worktree non-existent &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#4: at root' '\n+\tcat >4/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/4\n+setup: cwd: $TRASH_DIRECTORY/4\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 4\n+'\n+\n+test_expect_failure '#4: in subdir' '\n+\tcat >4/sub/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/4\n+setup: cwd: $TRASH_DIRECTORY/4\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 4/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154727","messageId":"1288334934-17216-9-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 08/42] t1510: setup case #5","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:20Z","receivedAt":"2010-10-29T06:48:20Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 47 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 93cc9fb..a216849 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -529,4 +529,51 @@ EOF\n \ttest_repo 4/sub\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/core.worktree are ignored -> #0\n+\n+test_expect_success '#5: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 5 5/sub &&\n+\tcd 5 &&\n+\tgit init &&\n+\tgit config core.worktree non-existent &&\n+\texport GIT_WORK_TREE=non-existent-too &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#5: at root' '\n+\tcat >5/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/5\n+setup: cwd: $TRASH_DIRECTORY/5\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 5\n+'\n+\n+test_expect_failure '#5: in subdir' '\n+\tcat >5/sub/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/5\n+setup: cwd: $TRASH_DIRECTORY/5\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 5/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154728","messageId":"1288334934-17216-10-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 09/42] t1510: setup case #6","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:21Z","receivedAt":"2010-10-29T06:48:21Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  291 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 291 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex a216849..5957c45 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -576,4 +576,295 @@ EOF\n \ttest_repo 5/sub\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), core.worktree=.. at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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), core.worktree=..(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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, core.worktree=.. at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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, core.worktree=..(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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), core.worktree=.. in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: 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), core.worktree=..(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: 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, core.worktree=.. in subdir' '\n+\tcat >6/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: 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, core.worktree=..(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: 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), core.worktree=../wt at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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), core.worktree=../wt(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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, core.worktree=../wt(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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, core.worktree=../wt at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6\n+setup: prefix: (null)\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), core.worktree=../wt in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6/sub/sub\n+setup: prefix: (null)\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), core.worktree=../wt(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6/sub/sub\n+setup: prefix: (null)\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, core.worktree=../wt(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6/sub/sub\n+setup: prefix: (null)\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, core.worktree=../wt in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY/6/wt\n+setup: cwd: $TRASH_DIRECTORY/6/sub/sub\n+setup: prefix: (null)\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), core.worktree=../.. at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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), core.worktree=../..(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=../..(rel) at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=../.. at root' '\n+\tcat >6/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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), core.worktree=../.. in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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), core.worktree=../..(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=../..(rel) in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=../.. in subdir' '\n+\tcat >6/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/6/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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":"154729","messageId":"1288334934-17216-11-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 10/42] t1510: setup case #7","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:22Z","receivedAt":"2010-10-29T06:48:22Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  266 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 266 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 5957c45..faefd10 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -867,4 +867,270 @@ 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 -> #3\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=root at root' '\n+\tcat >7/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 7\n+'\n+\n+test_expect_success '#7: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >7/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >7/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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=root in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: 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=root in subdir' '\n+\tcat >7/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >7/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: 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+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7\n+setup: prefix: (null)\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+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY/7/wt\n+setup: cwd: $TRASH_DIRECTORY/7/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/7/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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":"154731","messageId":"1288334934-17216-12-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 11/42] t1510: setup case #8","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:23Z","receivedAt":"2010-10-29T06:48:23Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 47 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex faefd10..769009d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1133,4 +1133,51 @@ 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+# #0 except that git_dir is set by .git file\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+setup: git_dir: $TRASH_DIRECTORY/8.git\n+setup: worktree: $TRASH_DIRECTORY/8\n+setup: cwd: $TRASH_DIRECTORY/8\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 8\n+'\n+\n+test_expect_success '#8: in subdir' '\n+\tcat >8/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/8.git\n+setup: worktree: $TRASH_DIRECTORY/8\n+setup: cwd: $TRASH_DIRECTORY/8\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 8/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154730","messageId":"1288334934-17216-13-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 12/42] t1510: setup case #9","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:24Z","receivedAt":"2010-10-29T06:48:24Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 47 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 769009d..aea63ed 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1180,4 +1180,51 @@ 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+# #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+test_expect_failure '#9: at root' '\n+\tcat >9/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/9.git\n+setup: worktree: $TRASH_DIRECTORY/9\n+setup: cwd: $TRASH_DIRECTORY/9\n+setup: prefix: (null)\n+EOF\n+\tGIT_WORK_TREE=non-existent test_repo 9\n+'\n+\n+test_expect_failure '#9: in subdir' '\n+\tcat >9/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/9.git\n+setup: worktree: $TRASH_DIRECTORY/9\n+setup: cwd: $TRASH_DIRECTORY/9\n+setup: prefix: 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":"154732","messageId":"1288334934-17216-14-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 13/42] t1510: setup case #10","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:25Z","receivedAt":"2010-10-29T06:48:25Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   67 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 67 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex aea63ed..a680f4e 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1227,4 +1227,71 @@ 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+# #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+setup: git_dir: $TRASH_DIRECTORY/10.git\n+setup: worktree: $TRASH_DIRECTORY/10\n+setup: cwd: $TRASH_DIRECTORY/10\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/10.git\n+setup: worktree: $TRASH_DIRECTORY/10/sub\n+setup: cwd: $TRASH_DIRECTORY/10/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/10.git\n+setup: worktree: $TRASH_DIRECTORY/10\n+setup: cwd: $TRASH_DIRECTORY/10\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/10.git\n+setup: worktree: $TRASH_DIRECTORY/10/sub\n+setup: cwd: $TRASH_DIRECTORY/10/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../.git test_repo 10/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154734","messageId":"1288334934-17216-15-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 14/42] t1510: setup case #11","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:26Z","receivedAt":"2010-10-29T06:48:26Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  267 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 267 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex a680f4e..09efd9b 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1294,4 +1294,271 @@ 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+# #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=root at root' '\n+\tcat >11/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 11\n+'\n+\n+test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >11/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >11/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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=root in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: 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=root in subdir' '\n+\tcat >11/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >11/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY/11/wt\n+setup: cwd: $TRASH_DIRECTORY/11/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/11.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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":"154733","messageId":"1288334934-17216-16-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 15/42] t1510: setup case #12","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:27Z","receivedAt":"2010-10-29T06:48:27Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 09efd9b..4a067ed 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1561,4 +1561,53 @@ 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+# #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+\tgit config core.worktree non-existent &&\n+\tmv .git ../12.git &&\n+\techo gitdir: ../12.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#12: at root' '\n+\tcat >12/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/12.git\n+setup: worktree: $TRASH_DIRECTORY/12\n+setup: cwd: $TRASH_DIRECTORY/12\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 12\n+'\n+\n+test_expect_failure '#12: in subdir' '\n+\tcat >12/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/12.git\n+setup: worktree: $TRASH_DIRECTORY/12\n+setup: cwd: $TRASH_DIRECTORY/12\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 12/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154735","messageId":"1288334934-17216-17-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 16/42] t1510: setup case #13","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:28Z","receivedAt":"2010-10-29T06:48:28Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 4a067ed..fd63ad4 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1610,4 +1610,53 @@ EOF\n \ttest_repo 12/sub\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+# #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+\tgit config core.worktree non-existent &&\n+\texport GIT_WORK_TREE=non-existent too &&\n+\tmv .git ../13.git &&\n+\techo gitdir: ../13.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#13: at root' '\n+\tcat >13/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/13.git\n+setup: worktree: $TRASH_DIRECTORY/13\n+setup: cwd: $TRASH_DIRECTORY/13\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 13\n+'\n+\n+test_expect_failure '#13: in subdir' '\n+\tcat >13/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/13.git\n+setup: worktree: $TRASH_DIRECTORY/13\n+setup: cwd: $TRASH_DIRECTORY/13\n+setup: prefix: sub/\n+EOF\n+\ttest_repo 13/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154736","messageId":"1288334934-17216-18-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 17/42] t1510: setup case #14","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:29Z","receivedAt":"2010-10-29T06:48:29Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  291 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 291 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex fd63ad4..c14ba8a 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1659,4 +1659,295 @@ EOF\n \ttest_repo 13/sub\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+# #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), core.worktree=../14 at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\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), core.worktree=../14(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14 &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, core.worktree=../14 at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\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, core.worktree=../14(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14 &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: 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), core.worktree=../14(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14 &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, core.worktree=../14 in subdir' '\n+\tcat >14/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: 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, core.worktree=../14(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: sub/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14 &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\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), core.worktree=../14/wt(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14/wt &&\n+\tGIT_DIR=.git test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14/wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n+'\n+\n+test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14\n+setup: prefix: (null)\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), core.worktree=../14/wt in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14/sub/sub\n+setup: prefix: (null)\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), core.worktree=../14/wt(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14/wt &&\n+\tGIT_DIR=../../.git test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/14.git/config\" core.worktree ../14/wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n+'\n+\n+test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY/14/wt\n+setup: cwd: $TRASH_DIRECTORY/14/sub/sub\n+setup: prefix: (null)\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), core.worktree=.. at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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), core.worktree=..(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=..(rel) at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=.. at root' '\n+\tcat >14/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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), core.worktree=.. in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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), core.worktree=..(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=..(rel) in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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, core.worktree=.. in subdir' '\n+\tcat >14/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/14.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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":"154737","messageId":"1288334934-17216-19-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 18/42] t1510: setup case #15","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:30Z","receivedAt":"2010-10-29T06:48:30Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  268 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 268 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex c14ba8a..d10ab68 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1950,4 +1950,272 @@ 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+# #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=root at root' '\n+\tcat >15/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 15\n+'\n+\n+test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >15/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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=root(rel) at root' '\n+\tcat >15/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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=root in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: 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=root in subdir' '\n+\tcat >15/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: 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=root(rel) in subdir' '\n+\tcat >15/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY/15/wt\n+setup: cwd: $TRASH_DIRECTORY/15/sub/sub\n+setup: prefix: (null)\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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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+setup: git_dir: $TRASH_DIRECTORY/15.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 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":"154738","messageId":"1288334934-17216-20-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 19/42] t1510: setup case #16","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:31Z","receivedAt":"2010-10-29T06:48:31Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\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 d10ab68..491bcf6 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2218,4 +2218,139 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15/sub/sub\n '\n \n+#\n+# case #16.1\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+#  - cwd is inside .git\n+#\n+# Output:\n+#\n+#  - no worktree\n+#  - cwd is unchanged\n+#  - prefix is NULL\n+#  - git_dir is set\n+#  - cwd can't be outside worktree\n+\n+test_expect_success '#16.1: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 16 16/sub &&\n+\tcd 16 &&\n+\tgit init &&\n+\tmkdir .git/wt .git/wt/sub &&\n+\tcd ..\n+'\n+\n+test_expect_success '#16.1: at .git' '\n+\tcat >16/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/.git\n+'\n+\n+test_expect_success '#16.1: in .git/wt' '\n+\tcat >16/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/16/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/.git/wt\n+'\n+\n+test_expect_success '#16.1: in .git/wt/sub' '\n+\tcat >16/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/16/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/.git/wt/sub\n+'\n+\n+#\n+# case #16.2\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 set\n+#\n+# Output:\n+#\n+#  - no worktree\n+#  - cwd is unchanged\n+#  - prefix is NULL\n+#  - git_dir is set\n+#  - cwd can't be outside worktree\n+\n+test_expect_success '#16.2: setup' '\n+\tgit config --file=\"$TRASH_DIRECTORY/16/.git/config\" core.bare true\n+'\n+\n+test_expect_success '#16.2: at .git' '\n+\tcat >16/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/.git\n+'\n+\n+test_expect_success '#16.2: in .git/wt' '\n+\tcat >16/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/16/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/.git/wt\n+'\n+\n+test_expect_success '#16.2: in .git/wt/sub' '\n+\tcat >16/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/16/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/.git/wt/sub\n+'\n+\n+test_expect_success '#16.2: at root' '\n+\tcat >16/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16\n+'\n+\n+test_expect_failure '#16.2: in subdir' '\n+\tcat >16/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/16/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/16/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 16/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154739","messageId":"1288334934-17216-21-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 20/42] t1510: setup case #17","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:32Z","receivedAt":"2010-10-29T06:48:32Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  128 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 128 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 491bcf6..07abeac 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2353,4 +2353,132 @@ EOF\n \ttest_repo 16/sub\n '\n \n+#\n+# case #17.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+#  - cwd is inside .git\n+#\n+# Output:\n+#\n+# GIT_WORK_TREE is ignored -> #16.1 (with warnings perhaps)\n+\n+test_expect_success '#17.1: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 17 17/sub &&\n+\tcd 17 &&\n+\tgit init &&\n+\tmkdir .git/wt .git/wt/sub &&\n+\texport GIT_WORK_TREE=non-existent &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#17.1: at .git' '\n+\tcat >17/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/.git\n+'\n+\n+test_expect_failure '#17.1: in .git/wt' '\n+\tcat >17/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/17/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/.git/wt\n+'\n+\n+test_expect_failure '#17.1: in .git/wt/sub' '\n+\tcat >17/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/17/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/.git/wt/sub\n+'\n+\n+#\n+# case #17.2\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 set\n+#\n+# Output:\n+#\n+# GIT_WORK_TREE is ignored -> #16.2 (with warnings perhaps)\n+\n+test_expect_success '#17.2: setup' '\n+\tgit config --file=\"$TRASH_DIRECTORY/17/.git/config\" core.bare true\n+'\n+\n+test_expect_failure '#17.2: at .git' '\n+\tcat >17/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/.git\n+'\n+\n+test_expect_failure '#17.2: in .git/wt' '\n+\tcat >17/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/17/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/.git/wt\n+'\n+\n+test_expect_failure '#17.2: in .git/wt/sub' '\n+\tcat >17/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/17/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/.git/wt/sub\n+'\n+\n+test_expect_failure '#17.2: at root' '\n+\tcat >17/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17\n+'\n+\n+test_expect_failure '#17.2: in subdir' '\n+\tcat >17/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/17/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/17/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 17/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154740","messageId":"1288334934-17216-22-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 21/42] t1510: setup case #18","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:33Z","receivedAt":"2010-10-29T06:48:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   71 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 71 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 07abeac..13034e5 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2481,4 +2481,75 @@ EOF\n \ttest_repo 17/sub\n '\n \n+#\n+# case #18\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 set\n+#\n+# Output:\n+#\n+#  - no worktree (rule #8)\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 '#18: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 18 18/sub &&\n+\tcd 18 &&\n+\tgit init &&\n+\tmkdir .git/wt .git/wt/sub &&\n+\tgit config core.bare true &&\n+\tcd ..\n+'\n+\n+test_expect_success '#18: (rel) at root' '\n+\tcat >18/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/18\n+setup: prefix: (null)\n+EOF\n+\t GIT_DIR=.git test_repo 18\n+'\n+\n+test_expect_success '#18: at root' '\n+\tcat >18/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/18/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/18\n+setup: prefix: (null)\n+EOF\n+\t GIT_DIR=\"$TRASH_DIRECTORY/18/.git\" test_repo 18\n+'\n+\n+test_expect_success '#18: (rel) in subdir' '\n+\tcat >18/sub/expected <<EOF &&\n+setup: git_dir: ../.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/18/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../.git test_repo 18/sub\n+'\n+\n+test_expect_success '#18: in subdir' '\n+\tcat >18/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/18/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/18/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/18/.git\" test_repo 18/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154741","messageId":"1288334934-17216-23-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 22/42] t1510: setup case #19","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:34Z","receivedAt":"2010-10-29T06:48:34Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  266 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 266 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 13034e5..8538098 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2552,4 +2552,270 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/18/.git\" test_repo 18/sub\n '\n \n+#\n+# case #19\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is set\n+#  - .git is a directory\n+#  - core.worktree is not set\n+#  - core.bare is set\n+#\n+# Output:\n+#\n+# bare repo is overridden by GIT_WORK_TREE -> #3\n+\n+test_expect_success '#19: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 19 19/sub 19/sub/sub 19.wt 19.wt/sub 19/wt 19/wt/sub &&\n+\tcd 19 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tcd ..\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/19\" test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/19\" test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=. test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/19\" test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+\tcat >19/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/19\" test_repo 19/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=../.. test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/19/wt\" test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=wt test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/19/wt\" test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/19/wt\" test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=../../wt test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY/19/wt\n+setup: cwd: $TRASH_DIRECTORY/19/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/19/wt\" test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=.. test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >19/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 19\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=../../../ test_repo 19/sub/sub\n+'\n+\n+test_expect_success '#19: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >19/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/19/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 19/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 19/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154742","messageId":"1288334934-17216-24-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 23/42] t1510: setup case #20","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:35Z","receivedAt":"2010-10-29T06:48:35Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  128 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 128 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 8538098..0ace186 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2818,4 +2818,132 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/19/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 19/sub/sub\n '\n \n+#\n+# case #20.1\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+#  - cwd is inside .git\n+#\n+# Output:\n+#\n+# core.worktree is ignored -> #16.1\n+\n+test_expect_success '#20.1: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 20 20/sub &&\n+\tcd 20 &&\n+\tgit init &&\n+\tgit config core.worktree non-existent &&\n+\tmkdir .git/wt .git/wt/sub &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#20.1: at .git' '\n+\tcat >20/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/.git\n+'\n+\n+test_expect_failure '#20.1: in .git/wt' '\n+\tcat >20/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/20/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/.git/wt\n+'\n+\n+test_expect_failure '#20.1: in .git/wt/sub' '\n+\tcat >20/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/20/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/.git/wt/sub\n+'\n+\n+#\n+# case #20.2\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 set\n+#\n+# Output:\n+#\n+# core.worktree is ignored -> #16.2\n+\n+test_expect_success '#20.2: setup' '\n+\tgit config --file=\"$TRASH_DIRECTORY/20/.git/config\" core.bare true\n+'\n+\n+test_expect_success '#20.2: at .git' '\n+\tcat >20/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/.git\n+'\n+\n+test_expect_success '#20.2: in .git/wt' '\n+\tcat >20/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/20/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/.git/wt\n+'\n+\n+test_expect_success '#20.2: in .git/wt/sub' '\n+\tcat >20/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/20/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/.git/wt/sub\n+'\n+\n+test_expect_success '#20.2: at root' '\n+\tcat >20/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20\n+'\n+\n+test_expect_failure '#20.2: in subdir' '\n+\tcat >20/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/20/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/20/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 20/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154743","messageId":"1288334934-17216-25-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 24/42] t1510: setup case #21","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:36Z","receivedAt":"2010-10-29T06:48:36Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  129 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 129 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 0ace186..8d67514 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2946,4 +2946,133 @@ EOF\n \ttest_repo 20/sub\n '\n \n+#\n+# case #21.1\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+#  - cwd is inside .git\n+#\n+# Output:\n+#\n+# GIT_WORK_TREE/core.worktree are ignored -> #20.1\n+\n+test_expect_success '#21.1: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 21 21/sub &&\n+\tcd 21 &&\n+\tgit init &&\n+\tgit config core.worktree non-existent &&\n+\texport GIT_WORK_TREE=non-existent-too &&\n+\tmkdir .git/wt .git/wt/sub &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#21.1: at .git' '\n+\tcat >21/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/.git\n+'\n+\n+test_expect_failure '#21.1: in .git/wt' '\n+\tcat >21/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/21/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/.git/wt\n+'\n+\n+test_expect_failure '#21.1: in .git/wt/sub' '\n+\tcat >21/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/21/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/.git/wt/sub\n+'\n+\n+#\n+# case #21.2\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 set\n+#\n+# Output:\n+#\n+# GIT_WORK_TREE/core.worktree are ignored -> #20.2\n+\n+test_expect_success '#21.2: setup' '\n+\tgit config --file=\"$TRASH_DIRECTORY/21/.git/config\" core.bare true\n+'\n+\n+test_expect_failure '#21.2: at .git' '\n+\tcat >21/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/.git\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/.git\n+'\n+\n+test_expect_failure '#21.2: in .git/wt' '\n+\tcat >21/.git/wt/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/21/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/.git/wt\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/.git/wt\n+'\n+\n+test_expect_failure '#21.2: in .git/wt/sub' '\n+\tcat >21/.git/wt/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/21/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/.git/wt/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/.git/wt/sub\n+'\n+\n+test_expect_failure '#21.2: at root' '\n+\tcat >21/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21\n+'\n+\n+test_expect_failure '#21.2: in subdir' '\n+\tcat >21/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/21/.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/21/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 21/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154744","messageId":"1288334934-17216-26-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 25/42] t1510: setup case #22","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:37Z","receivedAt":"2010-10-29T06:48:37Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  333 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 333 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 8d67514..a7b6833 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3075,4 +3075,337 @@ EOF\n \ttest_repo 21/sub\n '\n \n+#\n+# case #22.1\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+#  - cwd is inside .git\n+#\n+# Output:\n+#\n+# bare attribute is ignored\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 '#22.1: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 22 &&\n+\tcd 22 &&\n+\tgit init &&\n+\tmkdir .git/sub .git/wt .git/wt/sub &&\n+\tcd ..\n+'\n+\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=. at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git\" &&\n+\tGIT_DIR=. test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.(rel) at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree . &&\n+\tGIT_DIR=. test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=. at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=.(rel) at root' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree . &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n+'\n+\n+test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git\" &&\n+\tGIT_DIR=.. test_repo 22/.git/sub\n+'\n+\n+test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree . &&\n+\tGIT_DIR=.. test_repo 22/.git/sub/\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=. in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=.(rel) in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree . &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=wt at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git/wt\" &&\n+\tGIT_DIR=. test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=wt(rel) at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: .\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree wt &&\n+\tGIT_DIR=. test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=wt(rel) at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=wt at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git/wt\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=wt in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: ..\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git/sub\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git/wt\" &&\n+\tGIT_DIR=.. test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=wt(rel) in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: ..\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git/sub\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree wt &&\n+\tGIT_DIR=.. test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=wt(rel) in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git/sub\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree wt &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=wt in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22/.git/wt\n+setup: cwd: $TRASH_DIRECTORY/22/.git/sub\n+setup: prefix: (null)\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22/.git/wt\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n+'\n+\n+test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22\" &&\n+\tGIT_DIR=. test_repo 22/.git\n+'\n+\n+test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree .. &&\n+\tGIT_DIR=. test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=..(rel) at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree .. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=.. at .git' '\n+\tcat >22/.git/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n+'\n+\n+test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22\" &&\n+\tGIT_DIR=.. test_repo 22/.git/sub\n+'\n+\n+test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree .. &&\n+\tGIT_DIR=.. test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=..(rel) in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree .. &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n+'\n+\n+test_expect_success '#22.1: GIT_DIR, core.worktree=.. in .git/sub' '\n+\tcat >22/.git/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/22/.git\n+setup: worktree: $TRASH_DIRECTORY/22\n+setup: cwd: $TRASH_DIRECTORY/22\n+setup: prefix: .git/sub/\n+EOF\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.worktree \"$TRASH_DIRECTORY/22\" &&\n+\tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n+'\n+\n+#\n+# case #22.2\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 set\n+#\n+# Output:\n+#\n+# core.worktree and core.bare conflict, won't fly.\n+\n+test_expect_success '#22.2: setup' '\n+\tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.bare true\n+'\n+\n+test_expect_failure '#22.2: at .git' '\n+\t(\n+\tcd 22/.git &&\n+\tGIT_DIR=. test_must_fail git symbolic-ref HEAD 2>result &&\n+\tgrep \"core.bare and core.worktree do not make sense\" result\n+\t)\n+'\n+\n+test_expect_failure '#22.2: at root' '\n+\t(\n+\tcd 22 &&\n+\tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n+\tgrep \"core.bare and core.worktree do not make sense\" result\n+\t)\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154746","messageId":"1288334934-17216-27-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 26/42] t1510: setup case #23","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:38Z","receivedAt":"2010-10-29T06:48:38Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  267 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 267 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex a7b6833..f699546 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3408,4 +3408,271 @@ test_expect_failure '#22.2: at root' '\n \t)\n '\n \n+#\n+# case #23\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 set\n+#\n+# Output:\n+#\n+# core.worktree is overridden by GIT_WORK_TREE -> #19\n+\n+test_expect_success '#23: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 23 23/sub 23/sub/sub 23.wt 23.wt/sub 23/wt 23/wt/sub &&\n+\tcd 23 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tgit config core.worktree non-existent &&\n+\tcd ..\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/23\" test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/23\" test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=. test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/23\" test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+\tcat >23/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/23\" test_repo 23/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=../.. test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/23/wt\" test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: .git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=wt test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/23/wt\" test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/23/wt\" test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: ../../.git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=../../wt test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY/23/wt\n+setup: cwd: $TRASH_DIRECTORY/23/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/23/wt\" test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=.. test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >23/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 23\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=../../../ test_repo 23/sub/sub\n+'\n+\n+test_expect_success '#23: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >23/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/23/.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 23/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 23/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154745","messageId":"1288334934-17216-28-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 27/42] t1510: setup case #24","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:39Z","receivedAt":"2010-10-29T06:48:39Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\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 f699546..1965838 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3675,4 +3675,52 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/23/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 23/sub/sub\n '\n \n+#\n+# case #24\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 set\n+#\n+# Output:\n+#\n+# #16.2 except git_dir is set according to .git file\n+\n+test_expect_success '#24: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 24 24/sub &&\n+\tcd 24 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tmv .git ../24.git &&\n+\techo gitdir: ../24.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_success '#24: at root' '\n+\tcat >24/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/24.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/24\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 24\n+'\n+\n+test_expect_success '#24: in subdir' '\n+\tcat >24/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/24.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/24/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 24/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154747","messageId":"1288334934-17216-29-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 28/42] t1510: setup case #25","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:40Z","receivedAt":"2010-10-29T06:48:40Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 1965838..a853337 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3723,4 +3723,53 @@ EOF\n \ttest_repo 24/sub\n '\n \n+#\n+# case #25\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 set\n+#\n+# Output:\n+#\n+# #17.2 except git_dir is set according to .git file\n+\n+test_expect_success '#25: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 25 25/sub &&\n+\tcd 25 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\texport GIT_WORK_TREE=non-existent &&\n+\tmv .git ../25.git &&\n+\techo gitdir: ../25.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#25: at root' '\n+\tcat >25/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/25.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/25\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 25\n+'\n+\n+test_expect_failure '#25: in subdir' '\n+\tcat >25/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/25.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/25/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 25/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154748","messageId":"1288334934-17216-30-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 29/42] t1510: setup case #26","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:41Z","receivedAt":"2010-10-29T06:48:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   68 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 68 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex a853337..270af69 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3772,4 +3772,72 @@ EOF\n \ttest_repo 25/sub\n '\n \n+#\n+# case #26\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 set\n+#\n+# Output:\n+#\n+# #18 except git_dir is set according to .git file\n+\n+test_expect_success '#26: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 26 26/sub &&\n+\tcd 26 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tmv .git ../26.git &&\n+\techo gitdir: ../26.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#26: (rel) at root' '\n+\tcat >26/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/26.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/26\n+setup: prefix: (null)\n+EOF\n+\t GIT_DIR=.git test_repo 26\n+'\n+\n+test_expect_failure '#26: at root' '\n+\tcat >26/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/26.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/26\n+setup: prefix: (null)\n+EOF\n+\t GIT_DIR=\"$TRASH_DIRECTORY/26/.git\" test_repo 26\n+'\n+\n+test_expect_failure '#26: (rel) in subdir' '\n+\tcat >26/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/26.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/26/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../.git test_repo 26/sub\n+'\n+\n+test_expect_failure '#26: in subdir' '\n+\tcat >26/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/26.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/26/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/26/.git\" test_repo 26/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154749","messageId":"1288334934-17216-31-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 30/42] t1510: setup case #27","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:42Z","receivedAt":"2010-10-29T06:48:42Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  268 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 268 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 270af69..e8e8d82 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3840,4 +3840,272 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/26/.git\" test_repo 26/sub\n '\n \n+#\n+# case #27\n+#\n+############################################################\n+#\n+# Input:\n+#\n+#  - GIT_WORK_TREE is set\n+#  - GIT_DIR is set\n+#  - .git is a file\n+#  - core.worktree is not set\n+#  - core.bare is set\n+#\n+# Output:\n+#\n+# #19 except git_dir is set according to .git file\n+\n+test_expect_success '#27: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 27 27/sub 27/sub/sub 27.wt 27.wt/sub 27/wt 27/wt/sub &&\n+\tcd 27 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tmv .git ../27.git &&\n+\techo gitdir: ../27.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=. test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+\tcat >27/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../.. test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=wt test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY/27/wt\n+setup: cwd: $TRASH_DIRECTORY/27/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=.. test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >27/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../../ test_repo 27/sub/sub\n+'\n+\n+test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >27/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/27.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 27/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154750","messageId":"1288334934-17216-32-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 31/42] t1510: setup case #28","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:43Z","receivedAt":"2010-10-29T06:48:43Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex e8e8d82..829e48f 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4108,4 +4108,53 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27/sub/sub\n '\n \n+#\n+# case #28\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 set\n+#\n+# Output:\n+#\n+# core.worktree is ignored -> #24\n+\n+test_expect_success '#28: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 28 28/sub &&\n+\tcd 28 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tgit config core.worktree non-existent &&\n+\tmv .git ../28.git &&\n+\techo gitdir: ../28.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_success '#28: at root' '\n+\tcat >28/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/28.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/28\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 28\n+'\n+\n+test_expect_success '#28: in subdir' '\n+\tcat >28/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/28.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/28/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 28/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154751","messageId":"1288334934-17216-33-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 32/42] t1510: setup case #29","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:44Z","receivedAt":"2010-10-29T06:48:44Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 829e48f..e691d1c 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4157,4 +4157,53 @@ EOF\n \ttest_repo 28/sub\n '\n \n+#\n+# case #29\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 set\n+#\n+# Output:\n+#\n+# GIT_WORK_TREE/core.worktree are ignored -> #28\n+\n+test_expect_success '#29: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 29 29/sub &&\n+\tcd 29 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\texport GIT_WORK_TREE=non-existent &&\n+\tmv .git ../29.git &&\n+\techo gitdir: ../29.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#29: at root' '\n+\tcat >29/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/29.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/29\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 29\n+'\n+\n+test_expect_failure '#29: in subdir' '\n+\tcat >29/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/29.git\n+setup: worktree: (null)\n+setup: cwd: $TRASH_DIRECTORY/29/sub\n+setup: prefix: (null)\n+EOF\n+\ttest_repo 29/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154752","messageId":"1288334934-17216-34-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 33/42] t1510: setup case #30","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:45Z","receivedAt":"2010-10-29T06:48:45Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   37 +++++++++++++++++++++++++++++++++++++\n 1 files changed, 37 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex e691d1c..02b8e65 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4206,4 +4206,41 @@ EOF\n \ttest_repo 29/sub\n '\n \n+#\n+# case #30\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 set\n+#\n+# Output:\n+#\n+# core.worktree and core.bare conflict, won't fly.\n+\n+test_expect_success '#30: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 30 &&\n+\tcd 30 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tgit config core.worktree non-existent &&\n+\tmv .git ../30.git &&\n+\techo gitdir: ../30.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#30: at root' '\n+\t(\n+\tcd 30 &&\n+\tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n+\tgrep \"core.bare and core.worktree do not make sense\" result\n+\t)\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154753","messageId":"1288334934-17216-35-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 34/42] t1510: setup case #31","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:46Z","receivedAt":"2010-10-29T06:48:46Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  269 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 269 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 02b8e65..fe65a02 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4243,4 +4243,273 @@ test_expect_failure '#30: at root' '\n \t)\n '\n \n+#\n+# case #31\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 set\n+#\n+# Output:\n+#\n+# #23 except git_dir is set according to .git file\n+\n+test_expect_success '#31: setup' '\n+\tunset GIT_DIR GIT_WORK_TREE &&\n+\tmkdir 31 31/sub 31/sub/sub 31.wt 31.wt/sub 31/wt 31/wt/sub &&\n+\tcd 31 &&\n+\tgit init &&\n+\tgit config core.bare true &&\n+\tgit config core.worktree non-existent &&\n+\tmv .git ../31.git &&\n+\techo gitdir: ../31.git >.git &&\n+\tcd ..\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=. test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=. test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+\tcat >31/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../.. test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=wt test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY/31/wt\n+setup: cwd: $TRASH_DIRECTORY/31/sub/sub\n+setup: prefix: (null)\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/\n+EOF\n+\tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=.. test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+\tcat >31/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/sub/sub/\n+EOF\n+\tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../../ test_repo 31/sub/sub\n+'\n+\n+test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+\tcat >31/sub/sub/expected <<EOF &&\n+setup: git_dir: $TRASH_DIRECTORY/31.git\n+setup: worktree: $TRASH_DIRECTORY\n+setup: cwd: $TRASH_DIRECTORY\n+setup: prefix: 31/sub/sub/\n+EOF\n+\tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31/sub/sub\n+'\n+\n test_done\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154754","messageId":"1288334934-17216-36-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:47Z","receivedAt":"2010-10-29T06:48:47Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"git-rev-parse.txt does not say much about this. But I'm sure\ngit-sh-setup.sh wants \"git rev-parse --git-dir\" be relative to user's\ncwd.\n\ngit_dir variable in environment.c on the other hand is relative to\ngit's cwd, not user's cwd. Convert the relative path (actualy by making it\nabsolute path) before printing out.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/rev-parse.c |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex a5a1c86..65c287b 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -647,7 +647,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\tstatic char cwd[PATH_MAX];\n \t\t\t\tint len;\n \t\t\t\tif (gitdir) {\n-\t\t\t\t\tputs(gitdir);\n+\t\t\t\t\tif (is_absolute_path(gitdir) || !prefix) {\n+\t\t\t\t\t\tputs(gitdir);\n+\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t}\n+\t\t\t\t\tputs(make_absolute_path(gitdir));\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t\tif (!prefix) {\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154755","messageId":"1288334934-17216-37-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 36/42] Add git_config_early()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:48Z","receivedAt":"2010-10-29T06:48:48Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This version of git_config() will be used during repository setup.\nAs a repository is being set up, $GIT_DIR is not nailed down yet,\ngit_pathdup() should not be used to get $GIT_DIR/config.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n cache.h  |    1 +\n config.c |   19 ++++++++++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex d1bee5d..123dd4b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -986,6 +986,7 @@ extern int git_config_parse_parameter(const char *text);\n extern int git_config_parse_environment(void);\n extern int git_config_from_parameters(config_fn_t fn, void *data);\n extern int git_config(config_fn_t fn, void *);\n+extern int git_config_early(config_fn_t fn, void *, const char *repo_config);\n extern int git_parse_ulong(const char *, unsigned long *);\n extern int git_config_int(const char *, const char *);\n extern unsigned long git_config_ulong(const char *, const char *);\ndiff --git a/config.c b/config.c\nindex 4b0a820..c431f41 100644\n--- a/config.c\n+++ b/config.c\n@@ -835,10 +835,9 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \treturn 0;\n }\n \n-int git_config(config_fn_t fn, void *data)\n+int git_config_early(config_fn_t fn, void *data, const char *repo_config)\n {\n \tint ret = 0, found = 0;\n-\tchar *repo_config = NULL;\n \tconst char *home = NULL;\n \n \t/* Setting $GIT_CONFIG makes git read _only_ the given config file. */\n@@ -860,12 +859,10 @@ int git_config(config_fn_t fn, void *data)\n \t\tfree(user_config);\n \t}\n \n-\trepo_config = git_pathdup(\"config\");\n-\tif (!access(repo_config, R_OK)) {\n+\tif (repo_config && !access(repo_config, R_OK)) {\n \t\tret += git_config_from_file(fn, repo_config, data);\n \t\tfound += 1;\n \t}\n-\tfree(repo_config);\n \n \tret += git_config_from_parameters(fn, data);\n \tif (config_parameters)\n@@ -876,6 +873,18 @@ int git_config(config_fn_t fn, void *data)\n \treturn ret;\n }\n \n+int git_config(config_fn_t fn, void *data)\n+{\n+\tchar *repo_config = NULL;\n+\tint ret;\n+\n+\trepo_config = git_pathdup(\"config\");\n+\tret = git_config_early(fn, data, repo_config);\n+\tif (repo_config)\n+\t\tfree(repo_config);\n+\treturn ret;\n+}\n+\n /*\n  * Find all the stuff for git_config_set() below.\n  */\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154756","messageId":"1288334934-17216-38-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 37/42] Use git_config_early() instead of git_config() during repo setup","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:49Z","receivedAt":"2010-10-29T06:48:49Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"When git_config() is called, either git_dir has already been set (by\n$GIT_DIR env or set_git_dir()), or it will default git_dir to \".git\".\n\ngit_config_early() gives setup functions more freedom because it does\nnot require git_dir. Give it a config path, it will happily examine\nit.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c |   47 +++++++++++++++++++++++++++++++++++------------\n 1 files changed, 35 insertions(+), 12 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex a3b76de..49a1a25 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -243,9 +243,21 @@ void setup_work_tree(void)\n \tinitialized = 1;\n }\n \n-static int check_repository_format_gently(int *nongit_ok)\n+static int check_repository_format_gently(const char *gitdir, int *nongit_ok)\n {\n-\tgit_config(check_repository_format_version, NULL);\n+\tchar repo_config[PATH_MAX+1];\n+\n+\t/*\n+\t * git_config() can't be used here because it calls git_pathdup()\n+\t * to get $GIT_CONFIG/config. That call will make setup_git_env()\n+\t * set git_dir to \".git\".\n+\t *\n+\t * We are in gitdir setup, no git dir has been found useable yet.\n+\t * Use a gentler version of git_config() to check if this repo\n+\t * is a good one.\n+\t */\n+\tsnprintf(repo_config, PATH_MAX, \"%s/config\", gitdir);\n+\tgit_config_early(check_repository_format_version, NULL, repo_config);\n \tif (GIT_REPO_VERSION < repository_format_version) {\n \t\tif (!nongit_ok)\n \t\t\tdie (\"Expected git repo version <= %d, found %d\",\n@@ -331,11 +343,11 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tif (!work_tree_env) {\n \t\tretval = set_work_tree(gitdirenv);\n \t\t/* config may override worktree */\n-\t\tif (check_repository_format_gently(nongit_ok))\n+\t\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n \t\t\treturn NULL;\n \t\treturn retval;\n \t}\n-\tif (check_repository_format_gently(nongit_ok))\n+\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n \t\treturn NULL;\n \tretval = get_relative_cwd(buffer, sizeof(buffer) - 1,\n \t\t\tget_git_work_tree());\n@@ -357,11 +369,17 @@ static int cwd_contains_git_dir(const char **gitfile_dirp)\n \t\t\tdie(\"Repository setup failed\");\n \t\treturn 1;\n \t}\n-\treturn is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT);\n+\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT)) {\n+\t\t*gitfile_dirp = DEFAULT_GIT_DIR_ENVIRONMENT;\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n }\n \n static const char *setup_discovered_git_dir(const char *work_tree_env,\n-\t\tint offset, int len, char *cwd, int *nongit_ok)\n+\t\t\t\t\t    const char *gitdir,\n+\t\t\t\t\t    int offset, int len,\n+\t\t\t\t\t    char *cwd, int *nongit_ok)\n {\n \tint root_len;\n \n@@ -370,7 +388,7 @@ static const char *setup_discovered_git_dir(const char *work_tree_env,\n \t\tinside_work_tree = 1;\n \troot_len = offset_1st_component(cwd);\n \tgit_work_tree_cfg = xstrndup(cwd, offset > root_len ? offset : root_len);\n-\tif (check_repository_format_gently(nongit_ok))\n+\tif (check_repository_format_gently(gitdir, nongit_ok))\n \t\treturn NULL;\n \tif (offset == len)\n \t\treturn NULL;\n@@ -396,9 +414,12 @@ static const char *setup_bare_git_dir(const char *work_tree_env,\n \t\troot_len = offset_1st_component(cwd);\n \t\tcwd[offset > root_len ? offset : root_len] = '\\0';\n \t\tset_git_dir(cwd);\n-\t} else\n+\t\tcheck_repository_format_gently(cwd, nongit_ok);\n+\t}\n+\telse {\n \t\tset_git_dir(\".\");\n-\tcheck_repository_format_gently(nongit_ok);\n+\t\tcheck_repository_format_gently(\".\", nongit_ok);\n+\t}\n \treturn NULL;\n }\n \n@@ -478,8 +499,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t\tcurrent_device = get_device_or_die(\".\", NULL);\n \tfor (;;) {\n \t\tif (cwd_contains_git_dir(&gitfile_dir))\n-\t\t\treturn setup_discovered_git_dir(work_tree_env, offset,\n-\t\t\t\t\t\t\tlen, cwd, nongit_ok);\n+\t\t\treturn setup_discovered_git_dir(work_tree_env,\n+\t\t\t\t\t\t\tgitfile_dir,\n+\t\t\t\t\t\t\toffset, len,\n+\t\t\t\t\t\t\tcwd, nongit_ok);\n \t\tif (is_git_directory(\".\"))\n \t\t\treturn setup_bare_git_dir(work_tree_env, offset,\n \t\t\t\t\t\t\tlen, cwd, nongit_ok);\n@@ -590,7 +613,7 @@ int check_repository_format_version(const char *var, const char *value, void *cb\n \n int check_repository_format(void)\n {\n-\treturn check_repository_format_gently(NULL);\n+\treturn check_repository_format_gently(get_git_dir(), NULL);\n }\n \n /*\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154757","messageId":"1288334934-17216-39-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 38/42] Remove all logic from get_git_work_tree()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:50Z","receivedAt":"2010-10-29T06:48:50Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This helps break things some more. Eventually all repo setup logic\nshould be centralized in setup_* functions. This helps push all the\nbugs back to setup_* functions.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/init-db.c |   13 +++++++++++--\n environment.c     |   21 ++-------------------\n 2 files changed, 13 insertions(+), 21 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 9d4886c..e3af9ea 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -414,6 +414,7 @@ static const char *const init_db_usage[] = {\n int cmd_init_db(int argc, const char **argv, const char *prefix)\n {\n \tconst char *git_dir;\n+\tconst char *work_tree;\n \tconst char *template_dir = NULL;\n \tunsigned int flags = 0;\n \tconst struct option init_db_options[] = {\n@@ -480,8 +481,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t * without --bare.  Catch the error early.\n \t */\n \tgit_dir = getenv(GIT_DIR_ENVIRONMENT);\n-\tif ((!git_dir || is_bare_repository_cfg == 1)\n-\t    && getenv(GIT_WORK_TREE_ENVIRONMENT))\n+\twork_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);\n+\tif ((!git_dir || is_bare_repository_cfg == 1) && work_tree)\n \t\tdie(\"%s (or --work-tree=<directory>) not allowed without \"\n \t\t    \"specifying %s (or --git-dir=<directory>)\",\n \t\t    GIT_WORK_TREE_ENVIRONMENT,\n@@ -510,10 +511,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\tif (!getcwd(git_work_tree_cfg, PATH_MAX))\n \t\t\t\tdie_errno (\"Cannot access current working directory\");\n \t\t}\n+\t\tif (work_tree)\n+\t\t\tset_git_work_tree(make_absolute_path(work_tree));\n+\t\telse\n+\t\t\tset_git_work_tree(git_work_tree_cfg);\n \t\tif (access(get_git_work_tree(), X_OK))\n \t\t\tdie_errno (\"Cannot access work tree '%s'\",\n \t\t\t\t   get_git_work_tree());\n \t}\n+\telse {\n+\t\tif (work_tree)\n+\t\t\tset_git_work_tree(make_absolute_path(work_tree));\n+\t}\n \n \tset_git_dir(make_absolute_path(git_dir));\n \ndiff --git a/environment.c b/environment.c\nindex de5581f..6d8c90b 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -137,30 +137,13 @@ static int git_work_tree_initialized;\n  */\n void set_git_work_tree(const char *new_work_tree)\n {\n-\tif (is_bare_repository_cfg >= 0)\n-\t\tdie(\"cannot set work tree after initialization\");\n-\tgit_work_tree_initialized = 1;\n-\tfree(work_tree);\n+\tif (git_work_tree_initialized)\n+\t\tdie(\"internal error: work tree has already been set\");\n \twork_tree = xstrdup(make_absolute_path(new_work_tree));\n-\tis_bare_repository_cfg = 0;\n }\n \n const char *get_git_work_tree(void)\n {\n-\tif (!git_work_tree_initialized) {\n-\t\twork_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);\n-\t\t/* core.bare = true overrides implicit and config work tree */\n-\t\tif (!work_tree && is_bare_repository_cfg < 1) {\n-\t\t\twork_tree = git_work_tree_cfg;\n-\t\t\t/* make_absolute_path also normalizes the path */\n-\t\t\tif (work_tree && !is_absolute_path(work_tree))\n-\t\t\t\twork_tree = xstrdup(make_absolute_path(git_path(\"%s\", work_tree)));\n-\t\t} else if (work_tree)\n-\t\t\twork_tree = xstrdup(make_absolute_path(work_tree));\n-\t\tgit_work_tree_initialized = 1;\n-\t\tif (work_tree)\n-\t\t\tis_bare_repository_cfg = 0;\n-\t}\n \treturn work_tree;\n }\n \n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154758","messageId":"1288334934-17216-40-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 39/42] setup: clean up setup_bare_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:51Z","receivedAt":"2010-10-29T06:48:51Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c |   19 +++++++++----------\n 1 files changed, 9 insertions(+), 10 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 49a1a25..cba9bec 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -400,26 +400,25 @@ static const char *setup_discovered_git_dir(const char *work_tree_env,\n \treturn cwd + offset;\n }\n \n-static const char *setup_bare_git_dir(const char *work_tree_env,\n-\t\tint offset, int len, char *cwd, int *nongit_ok)\n+/* #16.1, #17.1, #20.1, #21.1, #22.1 (see t1510) */\n+static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongit_ok)\n {\n \tint root_len;\n \n+\tif (check_repository_format_gently(\".\", nongit_ok))\n+\t\treturn NULL;\n+\n \tinside_git_dir = 1;\n-\tif (!work_tree_env)\n-\t\tinside_work_tree = 0;\n+\tinside_work_tree = 0;\n \tif (offset != len) {\n \t\tif (chdir(cwd))\n \t\t\tdie_errno(\"Cannot come back to cwd\");\n \t\troot_len = offset_1st_component(cwd);\n \t\tcwd[offset > root_len ? offset : root_len] = '\\0';\n \t\tset_git_dir(cwd);\n-\t\tcheck_repository_format_gently(cwd, nongit_ok);\n \t}\n-\telse {\n+\telse\n \t\tset_git_dir(\".\");\n-\t\tcheck_repository_format_gently(\".\", nongit_ok);\n-\t}\n \treturn NULL;\n }\n \n@@ -504,8 +503,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t\t\t\t\t\t\toffset, len,\n \t\t\t\t\t\t\tcwd, nongit_ok);\n \t\tif (is_git_directory(\".\"))\n-\t\t\treturn setup_bare_git_dir(work_tree_env, offset,\n-\t\t\t\t\t\t\tlen, cwd, nongit_ok);\n+\t\t\treturn setup_bare_git_dir(cwd, offset, len, nongit_ok);\n+\n \t\twhile (--offset > ceil_offset && cwd[offset] != '/');\n \t\tif (offset <= ceil_offset)\n \t\t\treturn setup_nongit(cwd, nongit_ok);\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154759","messageId":"1288334934-17216-41-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 40/42] setup: clean up setup_discovered_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:52Z","receivedAt":"2010-10-29T06:48:52Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"If core.bare is true, discard the discovered worktree.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c |   68 ++++++++++++++++++++++++++++++++++----------------------------\n 1 files changed, 37 insertions(+), 31 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex cba9bec..dc91e0a 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -360,36 +360,30 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \treturn retval;\n }\n \n-static int cwd_contains_git_dir(const char **gitfile_dirp)\n-{\n-\tconst char *gitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n-\t*gitfile_dirp = gitfile_dir;\n-\tif (gitfile_dir) {\n-\t\tif (set_git_dir(gitfile_dir))\n-\t\t\tdie(\"Repository setup failed\");\n-\t\treturn 1;\n-\t}\n-\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT)) {\n-\t\t*gitfile_dirp = DEFAULT_GIT_DIR_ENVIRONMENT;\n-\t\treturn 1;\n-\t}\n-\treturn 0;\n-}\n-\n-static const char *setup_discovered_git_dir(const char *work_tree_env,\n-\t\t\t\t\t    const char *gitdir,\n-\t\t\t\t\t    int offset, int len,\n-\t\t\t\t\t    char *cwd, int *nongit_ok)\n+static const char *setup_discovered_git_dir(const char *gitdir,\n+\t\t\t\t\t    char *cwd, int offset, int len,\n+\t\t\t\t\t    int *nongit_ok)\n {\n \tint root_len;\n \n+\tif (check_repository_format_gently(gitdir, nongit_ok))\n+\t\treturn NULL;\n+\n+\t/* #16.2, #17.2, #20.2, #21.2, #24, #25, #28, #29 (see t1510) */\n+\tif (is_bare_repository_cfg > 0) {\n+\t\tset_git_dir(offset == len ? gitdir : make_absolute_path(gitdir));\n+\t\tif (chdir(cwd))\n+\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\treturn NULL;\n+\t}\n+\n+\t/* #0, #1, #5, #8, #9, #12, #13 */\n+\tset_git_work_tree(\".\");\n+\tset_git_dir(gitdir);\n \tinside_git_dir = 0;\n-\tif (!work_tree_env)\n-\t\tinside_work_tree = 1;\n+\tinside_work_tree = 1;\n \troot_len = offset_1st_component(cwd);\n \tgit_work_tree_cfg = xstrndup(cwd, offset > root_len ? offset : root_len);\n-\tif (check_repository_format_gently(gitdir, nongit_ok))\n-\t\treturn NULL;\n \tif (offset == len)\n \t\treturn NULL;\n \n@@ -451,8 +445,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \tconst char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n-\tconst char *gitdirenv;\n-\tconst char *gitfile_dir;\n+\tconst char *gitdirenv, *ret;\n+\tchar *gitfile;\n \tint len, offset, ceil_offset;\n \tdev_t current_device = 0;\n \tint one_filesystem = 1;\n@@ -497,11 +491,23 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \tif (one_filesystem)\n \t\tcurrent_device = get_device_or_die(\".\", NULL);\n \tfor (;;) {\n-\t\tif (cwd_contains_git_dir(&gitfile_dir))\n-\t\t\treturn setup_discovered_git_dir(work_tree_env,\n-\t\t\t\t\t\t\tgitfile_dir,\n-\t\t\t\t\t\t\toffset, len,\n-\t\t\t\t\t\t\tcwd, nongit_ok);\n+\t\tgitfile = (char*)read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tif (gitfile)\n+\t\t\tgitdirenv = gitfile = xstrdup(gitfile);\n+\t\telse {\n+\t\t\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))\n+\t\t\t\tgitdirenv = DEFAULT_GIT_DIR_ENVIRONMENT;\n+\t\t}\n+\n+\t\tif (gitdirenv) {\n+\t\t\tret = setup_discovered_git_dir(gitdirenv,\n+\t\t\t\t\t\t       cwd, offset, len,\n+\t\t\t\t\t\t       nongit_ok);\n+\t\t\tfree(gitfile);\n+\t\t\treturn ret;\n+\t\t}\n+\t\tfree(gitfile);\n+\n \t\tif (is_git_directory(\".\"))\n \t\t\treturn setup_bare_git_dir(cwd, offset, len, nongit_ok);\n \n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154760","messageId":"1288334934-17216-42-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 41/42] setup: rework setup_explicit_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:53Z","receivedAt":"2010-10-29T06:48:53Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This function is the most complex one among the three setup_*\nfunctions because all GIT_DIR, GIT_WORK_TREE, core.worktree and\ncore.bare are involved.\n\nBecause core.worktree is only effective inside\nsetup_explicit_git_dir() and the extra code in setup_git_directory()\nis to handle that. The extra code can now be retired.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c |  135 ++++++++++++++++++++++++++++++++++++--------------------------\n 1 files changed, 78 insertions(+), 57 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex dc91e0a..ba2a90e 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -208,24 +208,6 @@ int is_inside_work_tree(void)\n \treturn inside_work_tree;\n }\n \n-/*\n- * set_work_tree() is only ever called if you set GIT_DIR explicitly.\n- * The old behaviour (which we retain here) is to set the work tree root\n- * to the cwd, unless overridden by the config, the command line, or\n- * GIT_WORK_TREE.\n- */\n-static const char *set_work_tree(const char *dir)\n-{\n-\tchar buffer[PATH_MAX + 1];\n-\n-\tif (!getcwd(buffer, sizeof(buffer)))\n-\t\tdie (\"Could not get the current working directory\");\n-\tgit_work_tree_cfg = xstrdup(buffer);\n-\tinside_work_tree = 1;\n-\n-\treturn NULL;\n-}\n-\n void setup_work_tree(void)\n {\n \tconst char *work_tree, *git_dir;\n@@ -326,38 +308,92 @@ const char *read_gitfile_gently(const char *path)\n }\n \n static const char *setup_explicit_git_dir(const char *gitdirenv,\n-\t\t\t\tconst char *work_tree_env, int *nongit_ok)\n+\t\t\t\t\t  char *cwd, int len,\n+\t\t\t\t\t  int *nongit_ok)\n {\n-\tstatic char buffer[1024 + 1];\n-\tconst char *retval;\n+\tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n+\tconst char *worktree;\n+\tchar *gitfile;\n \n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n \t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n+\n+\tgitfile = (char*)read_gitfile_gently(gitdirenv);\n+\tif (gitfile) {\n+\t\tgitfile = xstrdup(gitfile);\n+\t\tgitdirenv = gitfile;\n+\t}\n+\n \tif (!is_git_directory(gitdirenv)) {\n \t\tif (nongit_ok) {\n \t\t\t*nongit_ok = 1;\n+\t\t\tfree(gitfile);\n \t\t\treturn NULL;\n \t\t}\n \t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n \t}\n-\tif (!work_tree_env) {\n-\t\tretval = set_work_tree(gitdirenv);\n-\t\t/* config may override worktree */\n-\t\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n-\t\t\treturn NULL;\n-\t\treturn retval;\n+\n+\tif (check_repository_format_gently(gitdirenv, nongit_ok)) {\n+\t\tfree(gitfile);\n+\t\treturn NULL;\n \t}\n-\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n+\n+\t/* #3, #7, #11, #15, #19, #23, #27, #31 (see t1510) */\n+\tif (work_tree_env)\n+\t\tset_git_work_tree(work_tree_env);\n+\telse if (is_bare_repository_cfg > 0) {\n+\t\tif (git_work_tree_cfg) /* #22.2, #30 */\n+\t\t\tdie(\"core.bare and core.worktree do not make sense\");\n+\n+\t\t/* #18, #26 */\n+\t\tset_git_dir(gitdirenv);\n+\t\tfree(gitfile);\n \t\treturn NULL;\n-\tretval = get_relative_cwd(buffer, sizeof(buffer) - 1,\n-\t\t\tget_git_work_tree());\n-\tif (!retval || !*retval)\n+\t}\n+\telse if (git_work_tree_cfg) { /* #6, #14 */\n+\t\tif (is_absolute_path(git_work_tree_cfg))\n+\t\t\tset_git_work_tree(git_work_tree_cfg);\n+\t\telse {\n+\t\t\tchar core_worktree[PATH_MAX];\n+\t\t\tif (chdir(gitdirenv))\n+\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n+\t\t\tif (chdir(git_work_tree_cfg))\n+\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n+\t\t\tif (!getcwd(core_worktree, PATH_MAX))\n+\t\t\t\tdie_errno(\"Could not get directory '%s'\", git_work_tree_cfg);\n+\t\t\tif (chdir(cwd))\n+\t\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tset_git_work_tree(core_worktree);\n+\t\t}\n+\t}\n+\telse /* #2, #10 */\n+\t\tset_git_work_tree(\".\");\n+\n+\t/* set_git_work_tree() must have been called by now */\n+\tworktree = get_git_work_tree();\n+\n+\t/* both get_git_work_tree() and cwd are already normalized */\n+\tif (!strcmp(cwd, worktree)) { /* cwd == worktree */\n+\t\tset_git_dir(gitdirenv);\n+\t\tfree(gitfile);\n \t\treturn NULL;\n-\tset_git_dir(make_absolute_path(gitdirenv));\n-\tif (chdir(work_tree_env) < 0)\n-\t\tdie_errno (\"Could not chdir to '%s'\", work_tree_env);\n-\tstrcat(buffer, \"/\");\n-\treturn retval;\n+\t}\n+\n+\tif (!prefixcmp(cwd, worktree) &&\n+\t    cwd[strlen(worktree)] == '/') { /* cwd inside worktree */\n+\t\tset_git_dir(make_absolute_path(gitdirenv));\n+\t\tif (chdir(worktree))\n+\t\t\tdie_errno(\"Could not chdir to '%s'\", worktree);\n+\t\tcwd[len++] = '/';\n+\t\tcwd[len] = '\\0';\n+\t\tfree(gitfile);\n+\t\treturn cwd + strlen(worktree) + 1;\n+\t}\n+\n+\t/* cwd outside worktree */\n+\tset_git_dir(gitdirenv);\n+\tfree(gitfile);\n+\treturn NULL;\n }\n \n static const char *setup_discovered_git_dir(const char *gitdir,\n@@ -442,7 +478,6 @@ static dev_t get_device_or_die(const char *path, const char *prefix)\n  */\n static const char *setup_git_directory_gently_1(int *nongit_ok)\n {\n-\tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \tconst char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n \tconst char *gitdirenv, *ret;\n@@ -459,6 +494,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \tif (nongit_ok)\n \t\t*nongit_ok = 0;\n \n+\tif (!getcwd(cwd, sizeof(cwd)-1))\n+\t\tdie_errno(\"Unable to read current working directory\");\n+\toffset = len = strlen(cwd);\n+\n \t/*\n \t * If GIT_DIR is set explicitly, we're not going\n \t * to do any discovery, but we still do repository\n@@ -466,10 +505,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t */\n \tgitdirenv = getenv(GIT_DIR_ENVIRONMENT);\n \tif (gitdirenv)\n-\t\treturn setup_explicit_git_dir(gitdirenv, work_tree_env, nongit_ok);\n-\n-\tif (!getcwd(cwd, sizeof(cwd)-1))\n-\t\tdie_errno(\"Unable to read current working directory\");\n+\t\treturn setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);\n \n \tceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);\n \tif (ceil_offset < 0 && has_dos_drive_prefix(cwd))\n@@ -486,7 +522,6 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t * - ../../.git/\n \t *   etc.\n \t */\n-\toffset = len = strlen(cwd);\n \tone_filesystem = !git_env_bool(\"GIT_DISCOVERY_ACROSS_FILESYSTEM\", 0);\n \tif (one_filesystem)\n \t\tcurrent_device = get_device_or_die(\".\", NULL);\n@@ -629,19 +664,5 @@ int check_repository_format(void)\n  */\n const char *setup_git_directory(void)\n {\n-\tconst char *retval = setup_git_directory_gently(NULL);\n-\n-\t/* If the work tree is not the default one, recompute prefix */\n-\tif (inside_work_tree < 0) {\n-\t\tstatic char buffer[PATH_MAX + 1];\n-\t\tchar *rel;\n-\t\tif (retval && chdir(retval))\n-\t\t\tdie_errno (\"Could not jump back into original cwd\");\n-\t\trel = get_relative_cwd(buffer, PATH_MAX, get_git_work_tree());\n-\t\tif (rel && *rel && chdir(get_git_work_tree()))\n-\t\t\tdie_errno (\"Could not jump to working directory\");\n-\t\treturn rel && *rel ? strcat(rel, \"/\") : NULL;\n-\t}\n-\n-\treturn retval;\n+\treturn setup_git_directory_gently(NULL);\n }\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154761","messageId":"1288334934-17216-43-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 42/42] t1510: all failed tests are now fixed","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T06:48:54Z","receivedAt":"2010-10-29T06:48:54Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"get_git_work_tree() clean up patch impacts all three setup_* functions\nand makes it impossible to mark what patch fixes what tests. But\neverything is OK now.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  356 ++++++++++++++++++++++++------------------------\n 1 files changed, 178 insertions(+), 178 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex fe65a02..3eddc71 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -129,7 +129,7 @@ test_expect_success '#1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#1: at root' '\n+test_expect_success '#1: at root' '\n \tcat >1/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/1\n@@ -139,7 +139,7 @@ EOF\n \ttest_repo 1\n '\n \n-test_expect_failure '#1: in subdir' '\n+test_expect_success '#1: in subdir' '\n \tcat >1/sub/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/1\n@@ -509,7 +509,7 @@ test_expect_success '#4: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#4: at root' '\n+test_expect_success '#4: at root' '\n \tcat >4/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/4\n@@ -519,7 +519,7 @@ EOF\n \ttest_repo 4\n '\n \n-test_expect_failure '#4: in subdir' '\n+test_expect_success '#4: in subdir' '\n \tcat >4/sub/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/4\n@@ -556,7 +556,7 @@ test_expect_success '#5: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#5: at root' '\n+test_expect_success '#5: at root' '\n \tcat >5/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/5\n@@ -566,7 +566,7 @@ EOF\n \ttest_repo 5\n '\n \n-test_expect_failure '#5: in subdir' '\n+test_expect_success '#5: in subdir' '\n \tcat >5/sub/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/5\n@@ -647,7 +647,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=.. in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=.. in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY/6\n@@ -658,7 +658,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY/6\n@@ -823,7 +823,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -834,7 +834,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1207,7 +1207,7 @@ test_expect_success '#9: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#9: at root' '\n+test_expect_success '#9: at root' '\n \tcat >9/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/9.git\n setup: worktree: $TRASH_DIRECTORY/9\n@@ -1217,7 +1217,7 @@ EOF\n \tGIT_WORK_TREE=non-existent test_repo 9\n '\n \n-test_expect_failure '#9: in subdir' '\n+test_expect_success '#9: in subdir' '\n \tcat >9/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/9.git\n setup: worktree: $TRASH_DIRECTORY/9\n@@ -1254,7 +1254,7 @@ test_expect_success '#10: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#10: at root' '\n+test_expect_success '#10: at root' '\n \tcat >10/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10\n@@ -1264,7 +1264,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/10/.git\" test_repo 10\n '\n \n-test_expect_failure '#10: in subdir' '\n+test_expect_success '#10: in subdir' '\n \tcat >10/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10/sub\n@@ -1274,7 +1274,7 @@ 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+test_expect_success '#10: relative GIT_DIR at root' '\n \tcat >10/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10\n@@ -1284,7 +1284,7 @@ EOF\n \tGIT_DIR=.git test_repo 10\n '\n \n-test_expect_failure '#10: relative GIT_DIR in subdir' '\n+test_expect_success '#10: relative GIT_DIR in subdir' '\n \tcat >10/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10/sub\n@@ -1321,7 +1321,7 @@ test_expect_success '#11: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1331,7 +1331,7 @@ 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=root(rel) at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1341,7 +1341,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1351,7 +1351,7 @@ 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=root(rel) at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1361,7 +1361,7 @@ 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=root in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1371,7 +1371,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1381,7 +1381,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >11/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1391,7 +1391,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1401,7 +1401,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1411,7 +1411,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1421,7 +1421,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1431,7 +1431,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1441,7 +1441,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1451,7 +1451,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1461,7 +1461,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1471,7 +1471,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1481,7 +1481,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1491,7 +1491,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1501,7 +1501,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1511,7 +1511,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1521,7 +1521,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1531,7 +1531,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1541,7 +1541,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1551,7 +1551,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1590,7 +1590,7 @@ test_expect_success '#12: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#12: at root' '\n+test_expect_success '#12: at root' '\n \tcat >12/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/12.git\n setup: worktree: $TRASH_DIRECTORY/12\n@@ -1600,7 +1600,7 @@ EOF\n \ttest_repo 12\n '\n \n-test_expect_failure '#12: in subdir' '\n+test_expect_success '#12: in subdir' '\n \tcat >12/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/12.git\n setup: worktree: $TRASH_DIRECTORY/12\n@@ -1639,7 +1639,7 @@ test_expect_success '#13: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#13: at root' '\n+test_expect_success '#13: at root' '\n \tcat >13/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/13.git\n setup: worktree: $TRASH_DIRECTORY/13\n@@ -1649,7 +1649,7 @@ EOF\n \ttest_repo 13\n '\n \n-test_expect_failure '#13: in subdir' '\n+test_expect_success '#13: in subdir' '\n \tcat >13/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/13.git\n setup: worktree: $TRASH_DIRECTORY/13\n@@ -1686,7 +1686,7 @@ test_expect_success '#14: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1697,7 +1697,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1708,7 +1708,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14 at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14 at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1719,7 +1719,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1730,7 +1730,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1741,7 +1741,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1752,7 +1752,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14 in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14 in subdir' '\n \tcat >14/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1763,7 +1763,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1774,7 +1774,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1785,7 +1785,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1796,7 +1796,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1807,7 +1807,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1818,7 +1818,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1829,7 +1829,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1840,7 +1840,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1851,7 +1851,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1862,7 +1862,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1873,7 +1873,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1884,7 +1884,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1895,7 +1895,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=.. at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=.. at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1906,7 +1906,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1917,7 +1917,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1928,7 +1928,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1939,7 +1939,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=.. in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=.. in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1978,7 +1978,7 @@ test_expect_success '#15: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -1988,7 +1988,7 @@ 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=root(rel) at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -1998,7 +1998,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2008,7 +2008,7 @@ 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=root(rel) at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2018,7 +2018,7 @@ 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=root in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2028,7 +2028,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2038,7 +2038,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >15/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2048,7 +2048,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2058,7 +2058,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2068,7 +2068,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2078,7 +2078,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2088,7 +2088,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2098,7 +2098,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2108,7 +2108,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2118,7 +2118,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2128,7 +2128,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2138,7 +2138,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2148,7 +2148,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2158,7 +2158,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2168,7 +2168,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2178,7 +2178,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2188,7 +2188,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2198,7 +2198,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2208,7 +2208,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2343,7 +2343,7 @@ EOF\n \ttest_repo 16\n '\n \n-test_expect_failure '#16.2: in subdir' '\n+test_expect_success '#16.2: in subdir' '\n \tcat >16/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/16/.git\n setup: worktree: (null)\n@@ -2380,7 +2380,7 @@ test_expect_success '#17.1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#17.1: at .git' '\n+test_expect_success '#17.1: at .git' '\n \tcat >17/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2390,7 +2390,7 @@ EOF\n \ttest_repo 17/.git\n '\n \n-test_expect_failure '#17.1: in .git/wt' '\n+test_expect_success '#17.1: in .git/wt' '\n \tcat >17/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2400,7 +2400,7 @@ EOF\n \ttest_repo 17/.git/wt\n '\n \n-test_expect_failure '#17.1: in .git/wt/sub' '\n+test_expect_success '#17.1: in .git/wt/sub' '\n \tcat >17/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2431,7 +2431,7 @@ test_expect_success '#17.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/17/.git/config\" core.bare true\n '\n \n-test_expect_failure '#17.2: at .git' '\n+test_expect_success '#17.2: at .git' '\n \tcat >17/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2441,7 +2441,7 @@ EOF\n \ttest_repo 17/.git\n '\n \n-test_expect_failure '#17.2: in .git/wt' '\n+test_expect_success '#17.2: in .git/wt' '\n \tcat >17/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2451,7 +2451,7 @@ EOF\n \ttest_repo 17/.git/wt\n '\n \n-test_expect_failure '#17.2: in .git/wt/sub' '\n+test_expect_success '#17.2: in .git/wt/sub' '\n \tcat >17/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2461,7 +2461,7 @@ EOF\n \ttest_repo 17/.git/wt/sub\n '\n \n-test_expect_failure '#17.2: at root' '\n+test_expect_success '#17.2: at root' '\n \tcat >17/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: (null)\n@@ -2471,7 +2471,7 @@ EOF\n \ttest_repo 17\n '\n \n-test_expect_failure '#17.2: in subdir' '\n+test_expect_success '#17.2: in subdir' '\n \tcat >17/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2845,7 +2845,7 @@ test_expect_success '#20.1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#20.1: at .git' '\n+test_expect_success '#20.1: at .git' '\n \tcat >20/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2855,7 +2855,7 @@ EOF\n \ttest_repo 20/.git\n '\n \n-test_expect_failure '#20.1: in .git/wt' '\n+test_expect_success '#20.1: in .git/wt' '\n \tcat >20/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -2865,7 +2865,7 @@ EOF\n \ttest_repo 20/.git/wt\n '\n \n-test_expect_failure '#20.1: in .git/wt/sub' '\n+test_expect_success '#20.1: in .git/wt/sub' '\n \tcat >20/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -2936,7 +2936,7 @@ EOF\n \ttest_repo 20\n '\n \n-test_expect_failure '#20.2: in subdir' '\n+test_expect_success '#20.2: in subdir' '\n \tcat >20/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -2974,7 +2974,7 @@ test_expect_success '#21.1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#21.1: at .git' '\n+test_expect_success '#21.1: at .git' '\n \tcat >21/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2984,7 +2984,7 @@ EOF\n \ttest_repo 21/.git\n '\n \n-test_expect_failure '#21.1: in .git/wt' '\n+test_expect_success '#21.1: in .git/wt' '\n \tcat >21/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -2994,7 +2994,7 @@ EOF\n \ttest_repo 21/.git/wt\n '\n \n-test_expect_failure '#21.1: in .git/wt/sub' '\n+test_expect_success '#21.1: in .git/wt/sub' '\n \tcat >21/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3025,7 +3025,7 @@ test_expect_success '#21.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/21/.git/config\" core.bare true\n '\n \n-test_expect_failure '#21.2: at .git' '\n+test_expect_success '#21.2: at .git' '\n \tcat >21/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -3035,7 +3035,7 @@ EOF\n \ttest_repo 21/.git\n '\n \n-test_expect_failure '#21.2: in .git/wt' '\n+test_expect_success '#21.2: in .git/wt' '\n \tcat >21/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3045,7 +3045,7 @@ EOF\n \ttest_repo 21/.git/wt\n '\n \n-test_expect_failure '#21.2: in .git/wt/sub' '\n+test_expect_success '#21.2: in .git/wt/sub' '\n \tcat >21/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3055,7 +3055,7 @@ EOF\n \ttest_repo 21/.git/wt/sub\n '\n \n-test_expect_failure '#21.2: at root' '\n+test_expect_success '#21.2: at root' '\n \tcat >21/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: (null)\n@@ -3065,7 +3065,7 @@ EOF\n \ttest_repo 21\n '\n \n-test_expect_failure '#21.2: in subdir' '\n+test_expect_success '#21.2: in subdir' '\n \tcat >21/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3151,7 +3151,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22/.git\n@@ -3162,7 +3162,7 @@ EOF\n \tGIT_DIR=.. test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22/.git\n@@ -3283,7 +3283,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n \tcat >22/.git/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3294,7 +3294,7 @@ EOF\n \tGIT_DIR=. test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n \tcat >22/.git/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3327,7 +3327,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3338,7 +3338,7 @@ EOF\n \tGIT_DIR=.. test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3392,7 +3392,7 @@ test_expect_success '#22.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.bare true\n '\n \n-test_expect_failure '#22.2: at .git' '\n+test_expect_success '#22.2: at .git' '\n \t(\n \tcd 22/.git &&\n \tGIT_DIR=. test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -3400,7 +3400,7 @@ test_expect_failure '#22.2: at .git' '\n \t)\n '\n \n-test_expect_failure '#22.2: at root' '\n+test_expect_success '#22.2: at root' '\n \t(\n \tcd 22 &&\n \tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -3752,7 +3752,7 @@ test_expect_success '#25: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#25: at root' '\n+test_expect_success '#25: at root' '\n \tcat >25/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/25.git\n setup: worktree: (null)\n@@ -3762,7 +3762,7 @@ EOF\n \ttest_repo 25\n '\n \n-test_expect_failure '#25: in subdir' '\n+test_expect_success '#25: in subdir' '\n \tcat >25/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/25.git\n setup: worktree: (null)\n@@ -3800,7 +3800,7 @@ test_expect_success '#26: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#26: (rel) at root' '\n+test_expect_success '#26: (rel) at root' '\n \tcat >26/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3810,7 +3810,7 @@ EOF\n \t GIT_DIR=.git test_repo 26\n '\n \n-test_expect_failure '#26: at root' '\n+test_expect_success '#26: at root' '\n \tcat >26/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3820,7 +3820,7 @@ EOF\n \t GIT_DIR=\"$TRASH_DIRECTORY/26/.git\" test_repo 26\n '\n \n-test_expect_failure '#26: (rel) in subdir' '\n+test_expect_success '#26: (rel) in subdir' '\n \tcat >26/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3830,7 +3830,7 @@ EOF\n \tGIT_DIR=../.git test_repo 26/sub\n '\n \n-test_expect_failure '#26: in subdir' '\n+test_expect_success '#26: in subdir' '\n \tcat >26/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3868,7 +3868,7 @@ test_expect_success '#27: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3878,7 +3878,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3888,7 +3888,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3898,7 +3898,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3908,7 +3908,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3918,7 +3918,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3928,7 +3928,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >27/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3938,7 +3938,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3948,7 +3948,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3958,7 +3958,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3968,7 +3968,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3978,7 +3978,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=wt test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3988,7 +3988,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3998,7 +3998,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4008,7 +4008,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4018,7 +4018,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4028,7 +4028,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4038,7 +4038,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4048,7 +4048,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4058,7 +4058,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=.. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4068,7 +4068,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4078,7 +4078,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4088,7 +4088,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4098,7 +4098,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../../ test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4186,7 +4186,7 @@ test_expect_success '#29: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#29: at root' '\n+test_expect_success '#29: at root' '\n \tcat >29/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/29.git\n setup: worktree: (null)\n@@ -4196,7 +4196,7 @@ EOF\n \ttest_repo 29\n '\n \n-test_expect_failure '#29: in subdir' '\n+test_expect_success '#29: in subdir' '\n \tcat >29/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/29.git\n setup: worktree: (null)\n@@ -4235,7 +4235,7 @@ test_expect_success '#30: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#30: at root' '\n+test_expect_success '#30: at root' '\n \t(\n \tcd 30 &&\n \tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -4272,7 +4272,7 @@ test_expect_success '#31: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4282,7 +4282,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4292,7 +4292,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4302,7 +4302,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4312,7 +4312,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4322,7 +4322,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4332,7 +4332,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >31/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4342,7 +4342,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4352,7 +4352,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4362,7 +4362,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4372,7 +4372,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4382,7 +4382,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=wt test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4392,7 +4392,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4402,7 +4402,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4412,7 +4412,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4422,7 +4422,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4432,7 +4432,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4442,7 +4442,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4452,7 +4452,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4462,7 +4462,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=.. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4472,7 +4472,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4482,7 +4482,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4492,7 +4492,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4502,7 +4502,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../../ test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n-- \n1.7.0.2.445.gcbdb3\n"},{"id":"154768","messageId":"20101029082959.GA18708@do","threadId":"25587","inReplyTo":"1288334934-17216-43-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 42/42] t1510: all failed tests are now fixed","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-29T08:29:59Z","receivedAt":"2010-10-29T08:29:59Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Oct 29, 2010 at 01:48:54PM +0700, Nguyyyyn Thhhi Nggggc Duy wrote:\n> get_git_work_tree() clean up patch impacts all three setup_* functions\n> and makes it impossible to mark what patch fixes what tests. But\n> everything is OK now.\n\nAnd I forgot to amend the last bits in.\n\n---8<---\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 3eddc71..0343045 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -779,7 +779,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. at root' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. at root' '\n \tcat >6/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -790,7 +790,7 @@ EOF\n \tGIT_DIR=.git test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '\n \tcat >6/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n---8<---\n"},{"id":"154791","messageId":"AANLkTikJJnTXfWXKe5bm_Qyjmgna9g3vChdkPzoiAb4i@mail.gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 00/42] repo setup test cases and fixes","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-10-29T17:04:40Z","receivedAt":"2010-10-29T17:04:40Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n> This series includes setup coverage tests (180/376 fail). Then the fixes,\n> which bring down to zero failed test in the end. 02/42 describes the\n> rules. New rules are:\n\nShouldn't the fixes come first (for bisectability?). It don't much\nlike the idea of the test suite being horribly broken for a whole\nbunch of patches that someone might end up hitting while bisecting.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"154793","messageId":"AANLkTikO5N3JWYCJ0c8AQXra274NfAx9X0aUQTwsOGiw@mail.gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-36-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-10-29T17:06:27Z","receivedAt":"2010-10-29T17:06:27Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n> git-rev-parse.txt does not say much about this. But I'm sure\n> git-sh-setup.sh wants \"git rev-parse --git-dir\" be relative to user's\n> cwd.\n\nWe don't usually use \"I\" in commit messages, was this meant for after\nthe triple dash, or does this commit message just need work?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"154794","messageId":"20101029170906.GA29249@burratino","threadId":"25587","inReplyTo":"AANLkTikJJnTXfWXKe5bm_Qyjmgna9g3vChdkPzoiAb4i@mail.gmail.com","subject":"Re: [PATCH 00/42] repo setup test cases and fixes","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-10-29T17:09:06Z","receivedAt":"2010-10-29T17:09:06Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> 2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n\n>> This series includes setup coverage tests (180/376 fail). Then the fixes,\n>> which bring down to zero failed test in the end. 02/42 describes the\n>> rules. New rules are:\n>\n> Shouldn't the fixes come first (for bisectability?).\n\nGood point.  Ideally the tests would come first if the fixes are\ncontraversial, or be squashed with the fixes if neither is\ncontraversial, or after if the tests are contraversial but the fixes\nare not.\n\nFor bisectability and clarity, the tests should use test_expect_failure\nwhen they fail (like this patch series does) and change that to\ntest_expect_success in the patch that fixes them.\n"},{"id":"154795","messageId":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","threadId":"25587","inReplyTo":"1288334934-17216-39-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 38/42] Remove all logic from get_git_work_tree()","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-10-29T17:09:38Z","receivedAt":"2010-10-29T17:09:38Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n> This helps break things some more. Eventually all repo setup logic\n> should be centralized in setup_* functions. This helps push all the\n> bugs back to setup_* functions.\n\nI don't know about this, do we really want to willingly break the test\nsuite (and fixing it later)? Perhaps we can review this as-is and then\nsquash the commits before they are merged to next so that there is no\nbreakage? We could even attach the original commits as notes :).\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"154836","messageId":"AANLkTim1PBO3TELnRzAGXYK3B0cshzQCwj0udUncfpRb@mail.gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"Re: [PATCH 38/42] Remove all logic from get_git_work_tree()","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-30T04:38:38Z","receivedAt":"2010-10-30T04:38:38Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2010/10/30 Sverre Rabbelier <srabbelier@gmail.com>:\n> Heya,\n>\n> 2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n>> This helps break things some more. Eventually all repo setup logic\n>> should be centralized in setup_* functions. This helps push all the\n>> bugs back to setup_* functions.\n>\n> I don't know about this, do we really want to willingly break the test\n> suite (and fixing it later)? Perhaps we can review this as-is and then\n> squash the commits before they are merged to next so that there is no\n> breakage? We could even attach the original commits as notes :).\n\nSquashing is no good in terms of readability when we look back in\nhistory. Can git-bisect be taught that \"there is breakage in this\nsegment of commits, consider the whole segment a single commit\"?\n-- \nDuy\n"},{"id":"154837","messageId":"AANLkTinircf2H9GcqOym036o=av1dvNx9xDVOVXok6xt@mail.gmail.com","threadId":"25587","inReplyTo":"AANLkTikO5N3JWYCJ0c8AQXra274NfAx9X0aUQTwsOGiw@mail.gmail.com","subject":"Re: [PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-10-30T04:42:49Z","receivedAt":"2010-10-30T04:42:49Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2010/10/30 Sverre Rabbelier <srabbelier@gmail.com>:\n> Heya,\n>\n> 2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n>> git-rev-parse.txt does not say much about this. But I'm sure\n>> git-sh-setup.sh wants \"git rev-parse --git-dir\" be relative to user's\n>> cwd.\n>\n> We don't usually use \"I\" in commit messages, was this meant for after\n> the triple dash, or does this commit message just need work?\n\nI used \"I\" because I was not confident that this must be done this\nway. Perhaps after we agree that all users of \"git rev-parse\n--git-dir\" expect the same, commit message can be rewritten to reflect\nthat.\n-- \nDuy\n"},{"id":"154839","messageId":"20101030070942.GC30613@burratino","threadId":"25587","inReplyTo":"AANLkTinircf2H9GcqOym036o=av1dvNx9xDVOVXok6xt@mail.gmail.com","subject":"Re: [PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-10-30T07:09:42Z","receivedAt":"2010-10-30T07:09:42Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":">> 2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n\n>>> git-rev-parse.txt does not say much about this. But I'm sure\n>>> git-sh-setup.sh wants \"git rev-parse --git-dir\" be relative to user's\n>>> cwd.\n\nYes, $(git rev-parse --git-dir) should be relative to the caller's\nworking directory, or else git-sh-setup in the ! \"$NONGIT_OK\" case\nwill fail, as you noticed.\n\nMaybe this can be clarified?\n\nThe current behavior is often to print an absolute path rather than\na ../../etc string, but callers must be ready to accept a relative\npath, too.  The most common output is \".git\" (from the toplevel of\nan ordinary work tree).\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex 4a27643..10321cd 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -136,7 +136,12 @@ appending `/{asterisk}`.\n \tdirectory (typically a sequence of \"../\", or an empty string).\n \n --git-dir::\n-\tShow `$GIT_DIR` if defined else show the path to the .git directory.\n+\tShow `$GIT_DIR` if defined.  Otherwise, show the path to\n+\tthe .git directory, relative to the current directory.\n++\n+If `$GIT_DIR` is not defined and the current directory\n+is not detected to lie in a git repository or work tree,\n+print a message to stderr and exit with nonzero status.\n \n --is-inside-git-dir::\n \tWhen the current working directory is below the repository\n"},{"id":"154907","messageId":"1288592794-24221-1-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 1/9] git-rev-parse.txt: clarify --git-dir","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:26Z","receivedAt":"2010-11-01T06:26:26Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"From: Jonathan Nieder <jrnieder@gmail.com>\n\nThe current behavior is often to print an absolute path rather than\na ../../etc string, but callers must be ready to accept a relative\npath, too. The most common output is \".git\" (from the toplevel of\nan ordinary work tree).\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n 2010/10/30 Sverre Rabbelier <srabbelier@gmail.com>:\n > Heya,\n >\n > 2010/10/28 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:\n >> This helps break things some more. Eventually all repo setup logic\n >> should be centralized in setup_* functions. This helps push all the\n >> bugs back to setup_* functions.\n >\n > I don't know about this, do we really want to willingly break the test\n > suite (and fixing it later)? Perhaps we can review this as-is and then\n > squash the commits before they are merged to next so that there is no\n > breakage? We could even attach the original commits as notes :).\n\n OK. Take 2. I think it is bisectable this time. This replaces\n 35-42 (the fixing part, no need to resend 34 unchanged patches). More notes\n on each patch.\n\n Documentation/git-rev-parse.txt |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex 341ca90..a41f024 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -136,7 +136,12 @@ appending `/{asterisk}`.\n \tdirectory (typically a sequence of \"../\", or an empty string).\n \n --git-dir::\n-\tShow `$GIT_DIR` if defined else show the path to the .git directory.\n+\tShow `$GIT_DIR` if defined. Otherwise show the path to\n+\tthe .git directory, relative to the current directory.\n++\n+If `$GIT_DIR` is not defined and the current directory\n+is not detected to lie in a git repository or work tree\n+print a message to stderr and exit with nonzero status.\n \n --is-inside-git-dir::\n \tWhen the current working directory is below the repository\n-- \n1.7.3.2.210.g045198\n"},{"id":"154908","messageId":"1288592794-24221-2-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 2/9] rev-parse: prints --git-dir relative to user's cwd","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:27Z","receivedAt":"2010-11-01T06:26:27Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"git_dir variable in environment.c is relative to git's cwd, not user's\ncwd. Convert the relative path (actualy by making it absolute path)\nbefore printing out.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Unchanged, except the commit message.\n\n builtin/rev-parse.c |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex a5a1c86..65c287b 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -647,7 +647,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \t\t\t\tstatic char cwd[PATH_MAX];\n \t\t\t\tint len;\n \t\t\t\tif (gitdir) {\n-\t\t\t\t\tputs(gitdir);\n+\t\t\t\t\tif (is_absolute_path(gitdir) || !prefix) {\n+\t\t\t\t\t\tputs(gitdir);\n+\t\t\t\t\t\tcontinue;\n+\t\t\t\t\t}\n+\t\t\t\t\tputs(make_absolute_path(gitdir));\n \t\t\t\t\tcontinue;\n \t\t\t\t}\n \t\t\t\tif (!prefix) {\n-- \n1.7.3.2.210.g045198\n"},{"id":"154911","messageId":"1288592794-24221-3-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 3/9] Add git_config_early()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:28Z","receivedAt":"2010-11-01T06:26:28Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This version of git_config() will be used during repository setup.\nAs a repository is being set up, $GIT_DIR is not nailed down yet,\ngit_pathdup() should not be used to get $GIT_DIR/config.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Unchanged.\n\n cache.h  |    1 +\n config.c |   19 ++++++++++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex d1bee5d..123dd4b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -986,6 +986,7 @@ extern int git_config_parse_parameter(const char *text);\n extern int git_config_parse_environment(void);\n extern int git_config_from_parameters(config_fn_t fn, void *data);\n extern int git_config(config_fn_t fn, void *);\n+extern int git_config_early(config_fn_t fn, void *, const char *repo_config);\n extern int git_parse_ulong(const char *, unsigned long *);\n extern int git_config_int(const char *, const char *);\n extern unsigned long git_config_ulong(const char *, const char *);\ndiff --git a/config.c b/config.c\nindex 4b0a820..c431f41 100644\n--- a/config.c\n+++ b/config.c\n@@ -835,10 +835,9 @@ int git_config_from_parameters(config_fn_t fn, void *data)\n \treturn 0;\n }\n \n-int git_config(config_fn_t fn, void *data)\n+int git_config_early(config_fn_t fn, void *data, const char *repo_config)\n {\n \tint ret = 0, found = 0;\n-\tchar *repo_config = NULL;\n \tconst char *home = NULL;\n \n \t/* Setting $GIT_CONFIG makes git read _only_ the given config file. */\n@@ -860,12 +859,10 @@ int git_config(config_fn_t fn, void *data)\n \t\tfree(user_config);\n \t}\n \n-\trepo_config = git_pathdup(\"config\");\n-\tif (!access(repo_config, R_OK)) {\n+\tif (repo_config && !access(repo_config, R_OK)) {\n \t\tret += git_config_from_file(fn, repo_config, data);\n \t\tfound += 1;\n \t}\n-\tfree(repo_config);\n \n \tret += git_config_from_parameters(fn, data);\n \tif (config_parameters)\n@@ -876,6 +873,18 @@ int git_config(config_fn_t fn, void *data)\n \treturn ret;\n }\n \n+int git_config(config_fn_t fn, void *data)\n+{\n+\tchar *repo_config = NULL;\n+\tint ret;\n+\n+\trepo_config = git_pathdup(\"config\");\n+\tret = git_config_early(fn, data, repo_config);\n+\tif (repo_config)\n+\t\tfree(repo_config);\n+\treturn ret;\n+}\n+\n /*\n  * Find all the stuff for git_config_set() below.\n  */\n-- \n1.7.3.2.210.g045198\n"},{"id":"154909","messageId":"1288592794-24221-4-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 4/9] Use git_config_early() instead of git_config() during repo setup","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:29Z","receivedAt":"2010-11-01T06:26:29Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"When git_config() is called, either git_dir has already been set (by\n$GIT_DIR env or set_git_dir()), or it will default git_dir to \".git\".\n\ngit_config_early() gives setup functions more freedom because it does\nnot require git_dir. Give it a config path, it will happily examine\nit.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Unchanged.\n\n setup.c |   47 +++++++++++++++++++++++++++++++++++------------\n 1 files changed, 35 insertions(+), 12 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex a3b76de..49a1a25 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -243,9 +243,21 @@ void setup_work_tree(void)\n \tinitialized = 1;\n }\n \n-static int check_repository_format_gently(int *nongit_ok)\n+static int check_repository_format_gently(const char *gitdir, int *nongit_ok)\n {\n-\tgit_config(check_repository_format_version, NULL);\n+\tchar repo_config[PATH_MAX+1];\n+\n+\t/*\n+\t * git_config() can't be used here because it calls git_pathdup()\n+\t * to get $GIT_CONFIG/config. That call will make setup_git_env()\n+\t * set git_dir to \".git\".\n+\t *\n+\t * We are in gitdir setup, no git dir has been found useable yet.\n+\t * Use a gentler version of git_config() to check if this repo\n+\t * is a good one.\n+\t */\n+\tsnprintf(repo_config, PATH_MAX, \"%s/config\", gitdir);\n+\tgit_config_early(check_repository_format_version, NULL, repo_config);\n \tif (GIT_REPO_VERSION < repository_format_version) {\n \t\tif (!nongit_ok)\n \t\t\tdie (\"Expected git repo version <= %d, found %d\",\n@@ -331,11 +343,11 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tif (!work_tree_env) {\n \t\tretval = set_work_tree(gitdirenv);\n \t\t/* config may override worktree */\n-\t\tif (check_repository_format_gently(nongit_ok))\n+\t\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n \t\t\treturn NULL;\n \t\treturn retval;\n \t}\n-\tif (check_repository_format_gently(nongit_ok))\n+\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n \t\treturn NULL;\n \tretval = get_relative_cwd(buffer, sizeof(buffer) - 1,\n \t\t\tget_git_work_tree());\n@@ -357,11 +369,17 @@ static int cwd_contains_git_dir(const char **gitfile_dirp)\n \t\t\tdie(\"Repository setup failed\");\n \t\treturn 1;\n \t}\n-\treturn is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT);\n+\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT)) {\n+\t\t*gitfile_dirp = DEFAULT_GIT_DIR_ENVIRONMENT;\n+\t\treturn 1;\n+\t}\n+\treturn 0;\n }\n \n static const char *setup_discovered_git_dir(const char *work_tree_env,\n-\t\tint offset, int len, char *cwd, int *nongit_ok)\n+\t\t\t\t\t    const char *gitdir,\n+\t\t\t\t\t    int offset, int len,\n+\t\t\t\t\t    char *cwd, int *nongit_ok)\n {\n \tint root_len;\n \n@@ -370,7 +388,7 @@ static const char *setup_discovered_git_dir(const char *work_tree_env,\n \t\tinside_work_tree = 1;\n \troot_len = offset_1st_component(cwd);\n \tgit_work_tree_cfg = xstrndup(cwd, offset > root_len ? offset : root_len);\n-\tif (check_repository_format_gently(nongit_ok))\n+\tif (check_repository_format_gently(gitdir, nongit_ok))\n \t\treturn NULL;\n \tif (offset == len)\n \t\treturn NULL;\n@@ -396,9 +414,12 @@ static const char *setup_bare_git_dir(const char *work_tree_env,\n \t\troot_len = offset_1st_component(cwd);\n \t\tcwd[offset > root_len ? offset : root_len] = '\\0';\n \t\tset_git_dir(cwd);\n-\t} else\n+\t\tcheck_repository_format_gently(cwd, nongit_ok);\n+\t}\n+\telse {\n \t\tset_git_dir(\".\");\n-\tcheck_repository_format_gently(nongit_ok);\n+\t\tcheck_repository_format_gently(\".\", nongit_ok);\n+\t}\n \treturn NULL;\n }\n \n@@ -478,8 +499,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t\tcurrent_device = get_device_or_die(\".\", NULL);\n \tfor (;;) {\n \t\tif (cwd_contains_git_dir(&gitfile_dir))\n-\t\t\treturn setup_discovered_git_dir(work_tree_env, offset,\n-\t\t\t\t\t\t\tlen, cwd, nongit_ok);\n+\t\t\treturn setup_discovered_git_dir(work_tree_env,\n+\t\t\t\t\t\t\tgitfile_dir,\n+\t\t\t\t\t\t\toffset, len,\n+\t\t\t\t\t\t\tcwd, nongit_ok);\n \t\tif (is_git_directory(\".\"))\n \t\t\treturn setup_bare_git_dir(work_tree_env, offset,\n \t\t\t\t\t\t\tlen, cwd, nongit_ok);\n@@ -590,7 +613,7 @@ int check_repository_format_version(const char *var, const char *value, void *cb\n \n int check_repository_format(void)\n {\n-\treturn check_repository_format_gently(NULL);\n+\treturn check_repository_format_gently(get_git_dir(), NULL);\n }\n \n /*\n-- \n1.7.3.2.210.g045198\n"},{"id":"154910","messageId":"1288592794-24221-5-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 5/9] setup: limit get_git_work_tree()'s to explicit setup case only","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:30Z","receivedAt":"2010-11-01T06:26:30Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"get_git_work_tree() takes input as core.worktree, core.bare,\nGIT_WORK_TREE and decides correct worktree setting.\n\nUnfortunately it does not do its job well. core.worktree and\nGIT_WORK_TREE should only be taken into account, if GIT_DIR is set\n(which is handled by setup_explicit_git_dir). For other setup cases,\nonly core.bare matters.\n\nAdd a temporary variable setup_explicit to adjust get_git_work_tree()\nbehavior as such. This variable will be gone once setup_* rework is\ndone.\n\nAlso remove is_bare_repository_cfg check in set_git_work_tree() to\nease the rework. We are going to check for core.bare and core.worktree\nearly before setting worktree. For example, if core.bare is true, no\nneed to set worktree.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n I isolate setup_bare_git_dir and setup_discovered_git_dir from\n get_git_work_tree() with this patch. setup_explicit_git_dir will\n remove \"startup_info->setup_explicit = 1\", which means\n get_git_work_tree() can no longer affect setup_* even if all the\n logic is there.\n\n builtin/init-db.c     |    1 +\n cache.h               |    1 +\n environment.c         |   10 ++++++-\n setup.c               |   10 ++++++-\n t/t1510-repo-setup.sh |   66 ++++++++++++++++++++++++------------------------\n 5 files changed, 51 insertions(+), 37 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 9d4886c..ea06478 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -496,6 +496,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \tif (is_bare_repository_cfg < 0)\n \t\tis_bare_repository_cfg = guess_repository_type(git_dir);\n \n+\tstartup_info->setup_explicit = 1;\n \tif (!is_bare_repository_cfg) {\n \t\tif (git_dir) {\n \t\t\tconst char *git_dir_parent = strrchr(git_dir, '/');\ndiff --git a/cache.h b/cache.h\nindex 123dd4b..b2cdda7 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1119,6 +1119,7 @@ const char *split_cmdline_strerror(int cmdline_errno);\n /* git.c */\n struct startup_info {\n \tint have_repository;\n+\tint setup_explicit;\n };\n extern struct startup_info *startup_info;\n \ndiff --git a/environment.c b/environment.c\nindex de5581f..d811049 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -137,8 +137,6 @@ static int git_work_tree_initialized;\n  */\n void set_git_work_tree(const char *new_work_tree)\n {\n-\tif (is_bare_repository_cfg >= 0)\n-\t\tdie(\"cannot set work tree after initialization\");\n \tgit_work_tree_initialized = 1;\n \tfree(work_tree);\n \twork_tree = xstrdup(make_absolute_path(new_work_tree));\n@@ -147,6 +145,14 @@ void set_git_work_tree(const char *new_work_tree)\n \n const char *get_git_work_tree(void)\n {\n+\tif (startup_info && !startup_info->setup_explicit) {\n+\t\tif (is_bare_repository_cfg == 1)\n+\t\t\treturn NULL;\n+\t\tif (work_tree)\n+\t\t\tis_bare_repository_cfg = 0;\n+\t\treturn work_tree;\n+\t}\n+\n \tif (!git_work_tree_initialized) {\n \t\twork_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \t\t/* core.bare = true overrides implicit and config work tree */\ndiff --git a/setup.c b/setup.c\nindex 49a1a25..c7d7198 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -331,6 +331,8 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \tstatic char buffer[1024 + 1];\n \tconst char *retval;\n \n+\tif (startup_info)\n+\t\tstartup_info->setup_explicit = 1;\n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n \t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n \tif (!is_git_directory(gitdirenv)) {\n@@ -382,12 +384,15 @@ static const char *setup_discovered_git_dir(const char *work_tree_env,\n \t\t\t\t\t    char *cwd, int *nongit_ok)\n {\n \tint root_len;\n+\tchar *work_tree;\n \n \tinside_git_dir = 0;\n \tif (!work_tree_env)\n \t\tinside_work_tree = 1;\n \troot_len = offset_1st_component(cwd);\n-\tgit_work_tree_cfg = xstrndup(cwd, offset > root_len ? offset : root_len);\n+\twork_tree = xstrndup(cwd, offset > root_len ? offset : root_len);\n+\tset_git_work_tree(work_tree);\n+\tfree(work_tree);\n \tif (check_repository_format_gently(gitdir, nongit_ok))\n \t\treturn NULL;\n \tif (offset == len)\n@@ -627,7 +632,8 @@ const char *setup_git_directory(void)\n \tconst char *retval = setup_git_directory_gently(NULL);\n \n \t/* If the work tree is not the default one, recompute prefix */\n-\tif (inside_work_tree < 0) {\n+\tif ((!startup_info || startup_info->setup_explicit) &&\n+\t    inside_work_tree < 0) {\n \t\tstatic char buffer[PATH_MAX + 1];\n \t\tchar *rel;\n \t\tif (retval && chdir(retval))\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex fe65a02..629ba34 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -129,7 +129,7 @@ test_expect_success '#1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#1: at root' '\n+test_expect_success '#1: at root' '\n \tcat >1/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/1\n@@ -139,7 +139,7 @@ EOF\n \ttest_repo 1\n '\n \n-test_expect_failure '#1: in subdir' '\n+test_expect_success '#1: in subdir' '\n \tcat >1/sub/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/1\n@@ -509,7 +509,7 @@ test_expect_success '#4: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#4: at root' '\n+test_expect_success '#4: at root' '\n \tcat >4/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/4\n@@ -519,7 +519,7 @@ EOF\n \ttest_repo 4\n '\n \n-test_expect_failure '#4: in subdir' '\n+test_expect_success '#4: in subdir' '\n \tcat >4/sub/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/4\n@@ -556,7 +556,7 @@ test_expect_success '#5: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#5: at root' '\n+test_expect_success '#5: at root' '\n \tcat >5/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/5\n@@ -566,7 +566,7 @@ EOF\n \ttest_repo 5\n '\n \n-test_expect_failure '#5: in subdir' '\n+test_expect_success '#5: in subdir' '\n \tcat >5/sub/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: $TRASH_DIRECTORY/5\n@@ -1207,7 +1207,7 @@ test_expect_success '#9: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#9: at root' '\n+test_expect_success '#9: at root' '\n \tcat >9/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/9.git\n setup: worktree: $TRASH_DIRECTORY/9\n@@ -1217,7 +1217,7 @@ EOF\n \tGIT_WORK_TREE=non-existent test_repo 9\n '\n \n-test_expect_failure '#9: in subdir' '\n+test_expect_success '#9: in subdir' '\n \tcat >9/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/9.git\n setup: worktree: $TRASH_DIRECTORY/9\n@@ -1590,7 +1590,7 @@ test_expect_success '#12: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#12: at root' '\n+test_expect_success '#12: at root' '\n \tcat >12/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/12.git\n setup: worktree: $TRASH_DIRECTORY/12\n@@ -1600,7 +1600,7 @@ EOF\n \ttest_repo 12\n '\n \n-test_expect_failure '#12: in subdir' '\n+test_expect_success '#12: in subdir' '\n \tcat >12/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/12.git\n setup: worktree: $TRASH_DIRECTORY/12\n@@ -1639,7 +1639,7 @@ test_expect_success '#13: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#13: at root' '\n+test_expect_success '#13: at root' '\n \tcat >13/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/13.git\n setup: worktree: $TRASH_DIRECTORY/13\n@@ -1649,7 +1649,7 @@ EOF\n \ttest_repo 13\n '\n \n-test_expect_failure '#13: in subdir' '\n+test_expect_success '#13: in subdir' '\n \tcat >13/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/13.git\n setup: worktree: $TRASH_DIRECTORY/13\n@@ -2380,7 +2380,7 @@ test_expect_success '#17.1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#17.1: at .git' '\n+test_expect_success '#17.1: at .git' '\n \tcat >17/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2390,7 +2390,7 @@ EOF\n \ttest_repo 17/.git\n '\n \n-test_expect_failure '#17.1: in .git/wt' '\n+test_expect_success '#17.1: in .git/wt' '\n \tcat >17/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2400,7 +2400,7 @@ EOF\n \ttest_repo 17/.git/wt\n '\n \n-test_expect_failure '#17.1: in .git/wt/sub' '\n+test_expect_success '#17.1: in .git/wt/sub' '\n \tcat >17/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2431,7 +2431,7 @@ test_expect_success '#17.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/17/.git/config\" core.bare true\n '\n \n-test_expect_failure '#17.2: at .git' '\n+test_expect_success '#17.2: at .git' '\n \tcat >17/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2441,7 +2441,7 @@ EOF\n \ttest_repo 17/.git\n '\n \n-test_expect_failure '#17.2: in .git/wt' '\n+test_expect_success '#17.2: in .git/wt' '\n \tcat >17/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2451,7 +2451,7 @@ EOF\n \ttest_repo 17/.git/wt\n '\n \n-test_expect_failure '#17.2: in .git/wt/sub' '\n+test_expect_success '#17.2: in .git/wt/sub' '\n \tcat >17/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2461,7 +2461,7 @@ EOF\n \ttest_repo 17/.git/wt/sub\n '\n \n-test_expect_failure '#17.2: at root' '\n+test_expect_success '#17.2: at root' '\n \tcat >17/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: (null)\n@@ -2845,7 +2845,7 @@ test_expect_success '#20.1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#20.1: at .git' '\n+test_expect_success '#20.1: at .git' '\n \tcat >20/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2855,7 +2855,7 @@ EOF\n \ttest_repo 20/.git\n '\n \n-test_expect_failure '#20.1: in .git/wt' '\n+test_expect_success '#20.1: in .git/wt' '\n \tcat >20/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -2865,7 +2865,7 @@ EOF\n \ttest_repo 20/.git/wt\n '\n \n-test_expect_failure '#20.1: in .git/wt/sub' '\n+test_expect_success '#20.1: in .git/wt/sub' '\n \tcat >20/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -2974,7 +2974,7 @@ test_expect_success '#21.1: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#21.1: at .git' '\n+test_expect_success '#21.1: at .git' '\n \tcat >21/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -2984,7 +2984,7 @@ EOF\n \ttest_repo 21/.git\n '\n \n-test_expect_failure '#21.1: in .git/wt' '\n+test_expect_success '#21.1: in .git/wt' '\n \tcat >21/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -2994,7 +2994,7 @@ EOF\n \ttest_repo 21/.git/wt\n '\n \n-test_expect_failure '#21.1: in .git/wt/sub' '\n+test_expect_success '#21.1: in .git/wt/sub' '\n \tcat >21/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3025,7 +3025,7 @@ test_expect_success '#21.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/21/.git/config\" core.bare true\n '\n \n-test_expect_failure '#21.2: at .git' '\n+test_expect_success '#21.2: at .git' '\n \tcat >21/.git/expected <<EOF &&\n setup: git_dir: .\n setup: worktree: (null)\n@@ -3035,7 +3035,7 @@ EOF\n \ttest_repo 21/.git\n '\n \n-test_expect_failure '#21.2: in .git/wt' '\n+test_expect_success '#21.2: in .git/wt' '\n \tcat >21/.git/wt/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3045,7 +3045,7 @@ EOF\n \ttest_repo 21/.git/wt\n '\n \n-test_expect_failure '#21.2: in .git/wt/sub' '\n+test_expect_success '#21.2: in .git/wt/sub' '\n \tcat >21/.git/wt/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3055,7 +3055,7 @@ EOF\n \ttest_repo 21/.git/wt/sub\n '\n \n-test_expect_failure '#21.2: at root' '\n+test_expect_success '#21.2: at root' '\n \tcat >21/expected <<EOF &&\n setup: git_dir: .git\n setup: worktree: (null)\n@@ -3703,7 +3703,7 @@ test_expect_success '#24: setup' '\n \tcd ..\n '\n \n-test_expect_success '#24: at root' '\n+test_expect_failure '#24: at root' '\n \tcat >24/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/24.git\n setup: worktree: (null)\n@@ -3713,7 +3713,7 @@ EOF\n \ttest_repo 24\n '\n \n-test_expect_success '#24: in subdir' '\n+test_expect_failure '#24: in subdir' '\n \tcat >24/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/24.git\n setup: worktree: (null)\n@@ -4137,7 +4137,7 @@ test_expect_success '#28: setup' '\n \tcd ..\n '\n \n-test_expect_success '#28: at root' '\n+test_expect_failure '#28: at root' '\n \tcat >28/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/28.git\n setup: worktree: (null)\n@@ -4147,7 +4147,7 @@ EOF\n \ttest_repo 28\n '\n \n-test_expect_success '#28: in subdir' '\n+test_expect_failure '#28: in subdir' '\n \tcat >28/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/28.git\n setup: worktree: (null)\n-- \n1.7.3.2.210.g045198\n"},{"id":"154913","messageId":"1288592794-24221-6-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 6/9] setup: clean up setup_bare_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:31Z","receivedAt":"2010-11-01T06:26:31Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"work_tree_env argument is removed because this function does not need\nit. GIT_WORK_TREE is only effective inside setup_explicit_git_dir.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c |   19 +++++++++----------\n 1 files changed, 9 insertions(+), 10 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex c7d7198..a6cc044 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -405,26 +405,25 @@ static const char *setup_discovered_git_dir(const char *work_tree_env,\n \treturn cwd + offset;\n }\n \n-static const char *setup_bare_git_dir(const char *work_tree_env,\n-\t\tint offset, int len, char *cwd, int *nongit_ok)\n+/* #16.1, #17.1, #20.1, #21.1, #22.1 (see t1510) */\n+static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongit_ok)\n {\n \tint root_len;\n \n+\tif (check_repository_format_gently(\".\", nongit_ok))\n+\t\treturn NULL;\n+\n \tinside_git_dir = 1;\n-\tif (!work_tree_env)\n-\t\tinside_work_tree = 0;\n+\tinside_work_tree = 0;\n \tif (offset != len) {\n \t\tif (chdir(cwd))\n \t\t\tdie_errno(\"Cannot come back to cwd\");\n \t\troot_len = offset_1st_component(cwd);\n \t\tcwd[offset > root_len ? offset : root_len] = '\\0';\n \t\tset_git_dir(cwd);\n-\t\tcheck_repository_format_gently(cwd, nongit_ok);\n \t}\n-\telse {\n+\telse\n \t\tset_git_dir(\".\");\n-\t\tcheck_repository_format_gently(\".\", nongit_ok);\n-\t}\n \treturn NULL;\n }\n \n@@ -509,8 +508,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t\t\t\t\t\t\toffset, len,\n \t\t\t\t\t\t\tcwd, nongit_ok);\n \t\tif (is_git_directory(\".\"))\n-\t\t\treturn setup_bare_git_dir(work_tree_env, offset,\n-\t\t\t\t\t\t\tlen, cwd, nongit_ok);\n+\t\t\treturn setup_bare_git_dir(cwd, offset, len, nongit_ok);\n+\n \t\twhile (--offset > ceil_offset && cwd[offset] != '/');\n \t\tif (offset <= ceil_offset)\n \t\t\treturn setup_nongit(cwd, nongit_ok);\n-- \n1.7.3.2.210.g045198\n"},{"id":"154912","messageId":"1288592794-24221-7-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 7/9] setup: clean up setup_discovered_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:32Z","receivedAt":"2010-11-01T06:26:32Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"If core.bare is true, discard the discovered worktree, move back to\noriginal cwd.\n\nThis change may set GIT_DIR env var to \".git\" via set_git_dir(). This\nbothers alias handling because handle_alias() does\n\n1. prefix = setup_git_directory_gently(..)\n2. look up alias\n3. chdir(prefix)\n\nAfter step 1, GIT_DIR may be set to \".git\" (relative to worktree), but\nstep 3 moves cwd back to original cwd. When the next\nsetup_git_directory_gently() is called by run_builtin(), it will\nmistakenly find \".git\" in original cwd.\n\nAs a workaround, teach set_git_dir() not to set to\n\".git\". setup_git_env() will default to \".git\" later on. Alias\nhandling code will need more work later.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n The alias breakage is new. It should be fixed by calling setup_git_*\n only once. No \"chdir(prefix)\" any more. And that fix will be needed\n before we can turn more git_dir to relative path.\n\n But for now the workaround is enough, I think.\n\n environment.c         |    6 +++-\n setup.c               |   71 ++++++++++++++++++++++++-------------------------\n t/t1510-repo-setup.sh |   24 ++++++++--------\n 3 files changed, 51 insertions(+), 50 deletions(-)\n\ndiff --git a/environment.c b/environment.c\nindex d811049..15764ee 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -193,8 +193,10 @@ char *get_graft_file(void)\n \n int set_git_dir(const char *path)\n {\n-\tif (setenv(GIT_DIR_ENVIRONMENT, path, 1))\n-\t\treturn error(\"Could not set GIT_DIR to '%s'\", path);\n+\tif (strcmp(path, DEFAULT_GIT_DIR_ENVIRONMENT)) {\n+\t\tif (setenv(GIT_DIR_ENVIRONMENT, path, 1))\n+\t\t\treturn error(\"Could not set GIT_DIR to '%s'\", path);\n+\t}\n \tsetup_git_env();\n \treturn 0;\n }\ndiff --git a/setup.c b/setup.c\nindex a6cc044..2dd5f78 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -362,39 +362,26 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,\n \treturn retval;\n }\n \n-static int cwd_contains_git_dir(const char **gitfile_dirp)\n+static const char *setup_discovered_git_dir(const char *gitdir,\n+\t\t\t\t\t    char *cwd, int offset, int len,\n+\t\t\t\t\t    int *nongit_ok)\n {\n-\tconst char *gitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n-\t*gitfile_dirp = gitfile_dir;\n-\tif (gitfile_dir) {\n-\t\tif (set_git_dir(gitfile_dir))\n-\t\t\tdie(\"Repository setup failed\");\n-\t\treturn 1;\n-\t}\n-\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT)) {\n-\t\t*gitfile_dirp = DEFAULT_GIT_DIR_ENVIRONMENT;\n-\t\treturn 1;\n-\t}\n-\treturn 0;\n-}\n+\tif (check_repository_format_gently(gitdir, nongit_ok))\n+\t\treturn NULL;\n \n-static const char *setup_discovered_git_dir(const char *work_tree_env,\n-\t\t\t\t\t    const char *gitdir,\n-\t\t\t\t\t    int offset, int len,\n-\t\t\t\t\t    char *cwd, int *nongit_ok)\n-{\n-\tint root_len;\n-\tchar *work_tree;\n+\t/* #16.2, #17.2, #20.2, #21.2, #24, #25, #28, #29 (see t1510) */\n+\tif (is_bare_repository_cfg > 0) {\n+\t\tset_git_dir(offset == len ? gitdir : make_absolute_path(gitdir));\n+\t\tif (chdir(cwd))\n+\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\treturn NULL;\n+\t}\n \n+\t/* #0, #1, #5, #8, #9, #12, #13 */\n+\tset_git_work_tree(\".\");\n+\tset_git_dir(gitdir);\n \tinside_git_dir = 0;\n-\tif (!work_tree_env)\n-\t\tinside_work_tree = 1;\n-\troot_len = offset_1st_component(cwd);\n-\twork_tree = xstrndup(cwd, offset > root_len ? offset : root_len);\n-\tset_git_work_tree(work_tree);\n-\tfree(work_tree);\n-\tif (check_repository_format_gently(gitdir, nongit_ok))\n-\t\treturn NULL;\n+\tinside_work_tree = 1;\n \tif (offset == len)\n \t\treturn NULL;\n \n@@ -456,8 +443,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \tconst char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n-\tconst char *gitdirenv;\n-\tconst char *gitfile_dir;\n+\tconst char *gitdirenv, *ret;\n+\tchar *gitfile;\n \tint len, offset, ceil_offset;\n \tdev_t current_device = 0;\n \tint one_filesystem = 1;\n@@ -502,11 +489,23 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \tif (one_filesystem)\n \t\tcurrent_device = get_device_or_die(\".\", NULL);\n \tfor (;;) {\n-\t\tif (cwd_contains_git_dir(&gitfile_dir))\n-\t\t\treturn setup_discovered_git_dir(work_tree_env,\n-\t\t\t\t\t\t\tgitfile_dir,\n-\t\t\t\t\t\t\toffset, len,\n-\t\t\t\t\t\t\tcwd, nongit_ok);\n+\t\tgitfile = (char*)read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);\n+\t\tif (gitfile)\n+\t\t\tgitdirenv = gitfile = xstrdup(gitfile);\n+\t\telse {\n+\t\t\tif (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))\n+\t\t\t\tgitdirenv = DEFAULT_GIT_DIR_ENVIRONMENT;\n+\t\t}\n+\n+\t\tif (gitdirenv) {\n+\t\t\tret = setup_discovered_git_dir(gitdirenv,\n+\t\t\t\t\t\t       cwd, offset, len,\n+\t\t\t\t\t\t       nongit_ok);\n+\t\t\tfree(gitfile);\n+\t\t\treturn ret;\n+\t\t}\n+\t\tfree(gitfile);\n+\n \t\tif (is_git_directory(\".\"))\n \t\t\treturn setup_bare_git_dir(cwd, offset, len, nongit_ok);\n \ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 629ba34..d492996 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2343,7 +2343,7 @@ EOF\n \ttest_repo 16\n '\n \n-test_expect_failure '#16.2: in subdir' '\n+test_expect_success '#16.2: in subdir' '\n \tcat >16/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/16/.git\n setup: worktree: (null)\n@@ -2471,7 +2471,7 @@ EOF\n \ttest_repo 17\n '\n \n-test_expect_failure '#17.2: in subdir' '\n+test_expect_success '#17.2: in subdir' '\n \tcat >17/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2936,7 +2936,7 @@ EOF\n \ttest_repo 20\n '\n \n-test_expect_failure '#20.2: in subdir' '\n+test_expect_success '#20.2: in subdir' '\n \tcat >20/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -3065,7 +3065,7 @@ EOF\n \ttest_repo 21\n '\n \n-test_expect_failure '#21.2: in subdir' '\n+test_expect_success '#21.2: in subdir' '\n \tcat >21/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3703,7 +3703,7 @@ test_expect_success '#24: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#24: at root' '\n+test_expect_success '#24: at root' '\n \tcat >24/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/24.git\n setup: worktree: (null)\n@@ -3713,7 +3713,7 @@ EOF\n \ttest_repo 24\n '\n \n-test_expect_failure '#24: in subdir' '\n+test_expect_success '#24: in subdir' '\n \tcat >24/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/24.git\n setup: worktree: (null)\n@@ -3752,7 +3752,7 @@ test_expect_success '#25: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#25: at root' '\n+test_expect_success '#25: at root' '\n \tcat >25/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/25.git\n setup: worktree: (null)\n@@ -3762,7 +3762,7 @@ EOF\n \ttest_repo 25\n '\n \n-test_expect_failure '#25: in subdir' '\n+test_expect_success '#25: in subdir' '\n \tcat >25/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/25.git\n setup: worktree: (null)\n@@ -4137,7 +4137,7 @@ test_expect_success '#28: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#28: at root' '\n+test_expect_success '#28: at root' '\n \tcat >28/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/28.git\n setup: worktree: (null)\n@@ -4147,7 +4147,7 @@ EOF\n \ttest_repo 28\n '\n \n-test_expect_failure '#28: in subdir' '\n+test_expect_success '#28: in subdir' '\n \tcat >28/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/28.git\n setup: worktree: (null)\n@@ -4186,7 +4186,7 @@ test_expect_success '#29: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#29: at root' '\n+test_expect_success '#29: at root' '\n \tcat >29/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/29.git\n setup: worktree: (null)\n@@ -4196,7 +4196,7 @@ EOF\n \ttest_repo 29\n '\n \n-test_expect_failure '#29: in subdir' '\n+test_expect_success '#29: in subdir' '\n \tcat >29/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/29.git\n setup: worktree: (null)\n-- \n1.7.3.2.210.g045198\n"},{"id":"154914","messageId":"1288592794-24221-8-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 8/9] setup: rework setup_explicit_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:33Z","receivedAt":"2010-11-01T06:26:33Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This function is the most complex one among the three setup_*\nfunctions because all GIT_DIR, GIT_WORK_TREE, core.worktree and\ncore.bare are involved.\n\nBecause core.worktree is only effective inside\nsetup_explicit_git_dir() and the extra code in setup_git_directory()\nis to handle that. The extra code can now be retired.\n\nAlso note that setup_explicit assignment is removed, worktree setting\nis no longer decided by get_git_work_tree(). get_git_work_tree() will\nbe simplified in the next commit.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c               |  138 +++++++++++++----------\n t/t1510-repo-setup.sh |  286 ++++++++++++++++++++++++------------------------\n 2 files changed, 221 insertions(+), 203 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 2dd5f78..f6ea1ac 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -208,24 +208,6 @@ int is_inside_work_tree(void)\n \treturn inside_work_tree;\n }\n \n-/*\n- * set_work_tree() is only ever called if you set GIT_DIR explicitly.\n- * The old behaviour (which we retain here) is to set the work tree root\n- * to the cwd, unless overridden by the config, the command line, or\n- * GIT_WORK_TREE.\n- */\n-static const char *set_work_tree(const char *dir)\n-{\n-\tchar buffer[PATH_MAX + 1];\n-\n-\tif (!getcwd(buffer, sizeof(buffer)))\n-\t\tdie (\"Could not get the current working directory\");\n-\tgit_work_tree_cfg = xstrdup(buffer);\n-\tinside_work_tree = 1;\n-\n-\treturn NULL;\n-}\n-\n void setup_work_tree(void)\n {\n \tconst char *work_tree, *git_dir;\n@@ -326,40 +308,92 @@ const char *read_gitfile_gently(const char *path)\n }\n \n static const char *setup_explicit_git_dir(const char *gitdirenv,\n-\t\t\t\tconst char *work_tree_env, int *nongit_ok)\n+\t\t\t\t\t  char *cwd, int len,\n+\t\t\t\t\t  int *nongit_ok)\n {\n-\tstatic char buffer[1024 + 1];\n-\tconst char *retval;\n+\tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n+\tconst char *worktree;\n+\tchar *gitfile;\n \n-\tif (startup_info)\n-\t\tstartup_info->setup_explicit = 1;\n \tif (PATH_MAX - 40 < strlen(gitdirenv))\n \t\tdie(\"'$%s' too big\", GIT_DIR_ENVIRONMENT);\n+\n+\tgitfile = (char*)read_gitfile_gently(gitdirenv);\n+\tif (gitfile) {\n+\t\tgitfile = xstrdup(gitfile);\n+\t\tgitdirenv = gitfile;\n+\t}\n+\n \tif (!is_git_directory(gitdirenv)) {\n \t\tif (nongit_ok) {\n \t\t\t*nongit_ok = 1;\n+\t\t\tfree(gitfile);\n \t\t\treturn NULL;\n \t\t}\n \t\tdie(\"Not a git repository: '%s'\", gitdirenv);\n \t}\n-\tif (!work_tree_env) {\n-\t\tretval = set_work_tree(gitdirenv);\n-\t\t/* config may override worktree */\n-\t\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n-\t\t\treturn NULL;\n-\t\treturn retval;\n+\n+\tif (check_repository_format_gently(gitdirenv, nongit_ok)) {\n+\t\tfree(gitfile);\n+\t\treturn NULL;\n \t}\n-\tif (check_repository_format_gently(gitdirenv, nongit_ok))\n+\n+\t/* #3, #7, #11, #15, #19, #23, #27, #31 (see t1510) */\n+\tif (work_tree_env)\n+\t\tset_git_work_tree(work_tree_env);\n+\telse if (is_bare_repository_cfg > 0) {\n+\t\tif (git_work_tree_cfg) /* #22.2, #30 */\n+\t\t\tdie(\"core.bare and core.worktree do not make sense\");\n+\n+\t\t/* #18, #26 */\n+\t\tset_git_dir(gitdirenv);\n+\t\tfree(gitfile);\n \t\treturn NULL;\n-\tretval = get_relative_cwd(buffer, sizeof(buffer) - 1,\n-\t\t\tget_git_work_tree());\n-\tif (!retval || !*retval)\n+\t}\n+\telse if (git_work_tree_cfg) { /* #6, #14 */\n+\t\tif (is_absolute_path(git_work_tree_cfg))\n+\t\t\tset_git_work_tree(git_work_tree_cfg);\n+\t\telse {\n+\t\t\tchar core_worktree[PATH_MAX];\n+\t\t\tif (chdir(gitdirenv))\n+\t\t\t\tdie_errno(\"Could not chdir to '%s'\", gitdirenv);\n+\t\t\tif (chdir(git_work_tree_cfg))\n+\t\t\t\tdie_errno(\"Could not chdir to '%s'\", git_work_tree_cfg);\n+\t\t\tif (!getcwd(core_worktree, PATH_MAX))\n+\t\t\t\tdie_errno(\"Could not get directory '%s'\", git_work_tree_cfg);\n+\t\t\tif (chdir(cwd))\n+\t\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\t\tset_git_work_tree(core_worktree);\n+\t\t}\n+\t}\n+\telse /* #2, #10 */\n+\t\tset_git_work_tree(\".\");\n+\n+\t/* set_git_work_tree() must have been called by now */\n+\tworktree = get_git_work_tree();\n+\n+\t/* both get_git_work_tree() and cwd are already normalized */\n+\tif (!strcmp(cwd, worktree)) { /* cwd == worktree */\n+\t\tset_git_dir(gitdirenv);\n+\t\tfree(gitfile);\n \t\treturn NULL;\n-\tset_git_dir(make_absolute_path(gitdirenv));\n-\tif (chdir(work_tree_env) < 0)\n-\t\tdie_errno (\"Could not chdir to '%s'\", work_tree_env);\n-\tstrcat(buffer, \"/\");\n-\treturn retval;\n+\t}\n+\n+\tif (!prefixcmp(cwd, worktree) &&\n+\t    cwd[strlen(worktree)] == '/') { /* cwd inside worktree */\n+\t\tset_git_dir(make_absolute_path(gitdirenv));\n+\t\tif (chdir(worktree))\n+\t\t\tdie_errno(\"Could not chdir to '%s'\", worktree);\n+\t\tcwd[len++] = '/';\n+\t\tcwd[len] = '\\0';\n+\t\tfree(gitfile);\n+\t\treturn cwd + strlen(worktree) + 1;\n+\t}\n+\n+\t/* cwd outside worktree */\n+\tset_git_dir(gitdirenv);\n+\tfree(gitfile);\n+\treturn NULL;\n }\n \n static const char *setup_discovered_git_dir(const char *gitdir,\n@@ -440,7 +474,6 @@ static dev_t get_device_or_die(const char *path, const char *prefix)\n  */\n static const char *setup_git_directory_gently_1(int *nongit_ok)\n {\n-\tconst char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);\n \tconst char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);\n \tstatic char cwd[PATH_MAX+1];\n \tconst char *gitdirenv, *ret;\n@@ -457,6 +490,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \tif (nongit_ok)\n \t\t*nongit_ok = 0;\n \n+\tif (!getcwd(cwd, sizeof(cwd)-1))\n+\t\tdie_errno(\"Unable to read current working directory\");\n+\toffset = len = strlen(cwd);\n+\n \t/*\n \t * If GIT_DIR is set explicitly, we're not going\n \t * to do any discovery, but we still do repository\n@@ -464,10 +501,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t */\n \tgitdirenv = getenv(GIT_DIR_ENVIRONMENT);\n \tif (gitdirenv)\n-\t\treturn setup_explicit_git_dir(gitdirenv, work_tree_env, nongit_ok);\n-\n-\tif (!getcwd(cwd, sizeof(cwd)-1))\n-\t\tdie_errno(\"Unable to read current working directory\");\n+\t\treturn setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);\n \n \tceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);\n \tif (ceil_offset < 0 && has_dos_drive_prefix(cwd))\n@@ -484,7 +518,6 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t * - ../../.git/\n \t *   etc.\n \t */\n-\toffset = len = strlen(cwd);\n \tone_filesystem = !git_env_bool(\"GIT_DISCOVERY_ACROSS_FILESYSTEM\", 0);\n \tif (one_filesystem)\n \t\tcurrent_device = get_device_or_die(\".\", NULL);\n@@ -627,20 +660,5 @@ int check_repository_format(void)\n  */\n const char *setup_git_directory(void)\n {\n-\tconst char *retval = setup_git_directory_gently(NULL);\n-\n-\t/* If the work tree is not the default one, recompute prefix */\n-\tif ((!startup_info || startup_info->setup_explicit) &&\n-\t    inside_work_tree < 0) {\n-\t\tstatic char buffer[PATH_MAX + 1];\n-\t\tchar *rel;\n-\t\tif (retval && chdir(retval))\n-\t\t\tdie_errno (\"Could not jump back into original cwd\");\n-\t\trel = get_relative_cwd(buffer, PATH_MAX, get_git_work_tree());\n-\t\tif (rel && *rel && chdir(get_git_work_tree()))\n-\t\t\tdie_errno (\"Could not jump to working directory\");\n-\t\treturn rel && *rel ? strcat(rel, \"/\") : NULL;\n-\t}\n-\n-\treturn retval;\n+\treturn setup_git_directory_gently(NULL);\n }\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex d492996..0343045 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -647,7 +647,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=.. in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=.. in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY/6\n@@ -658,7 +658,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY/6\n@@ -779,7 +779,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. at root' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. at root' '\n \tcat >6/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -790,7 +790,7 @@ EOF\n \tGIT_DIR=.git test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '\n \tcat >6/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -823,7 +823,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -834,7 +834,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1254,7 +1254,7 @@ test_expect_success '#10: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#10: at root' '\n+test_expect_success '#10: at root' '\n \tcat >10/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10\n@@ -1264,7 +1264,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/10/.git\" test_repo 10\n '\n \n-test_expect_failure '#10: in subdir' '\n+test_expect_success '#10: in subdir' '\n \tcat >10/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10/sub\n@@ -1274,7 +1274,7 @@ 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+test_expect_success '#10: relative GIT_DIR at root' '\n \tcat >10/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10\n@@ -1284,7 +1284,7 @@ EOF\n \tGIT_DIR=.git test_repo 10\n '\n \n-test_expect_failure '#10: relative GIT_DIR in subdir' '\n+test_expect_success '#10: relative GIT_DIR in subdir' '\n \tcat >10/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10/sub\n@@ -1321,7 +1321,7 @@ test_expect_success '#11: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1331,7 +1331,7 @@ 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=root(rel) at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1341,7 +1341,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1351,7 +1351,7 @@ 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=root(rel) at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1361,7 +1361,7 @@ 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=root in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1371,7 +1371,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1381,7 +1381,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >11/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1391,7 +1391,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1401,7 +1401,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1411,7 +1411,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1421,7 +1421,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1431,7 +1431,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1441,7 +1441,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1451,7 +1451,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1461,7 +1461,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1471,7 +1471,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1481,7 +1481,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1491,7 +1491,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1501,7 +1501,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1511,7 +1511,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1521,7 +1521,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1531,7 +1531,7 @@ 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+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1541,7 +1541,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1551,7 +1551,7 @@ 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+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1686,7 +1686,7 @@ test_expect_success '#14: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1697,7 +1697,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1708,7 +1708,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14 at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14 at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1719,7 +1719,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1730,7 +1730,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1741,7 +1741,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1752,7 +1752,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14 in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14 in subdir' '\n \tcat >14/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1763,7 +1763,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1774,7 +1774,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1785,7 +1785,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1796,7 +1796,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1807,7 +1807,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1818,7 +1818,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1829,7 +1829,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1840,7 +1840,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1851,7 +1851,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1862,7 +1862,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1873,7 +1873,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1884,7 +1884,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1895,7 +1895,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=.. at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=.. at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1906,7 +1906,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1917,7 +1917,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1928,7 +1928,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1939,7 +1939,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=.. in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=.. in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1978,7 +1978,7 @@ test_expect_success '#15: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -1988,7 +1988,7 @@ 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=root(rel) at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -1998,7 +1998,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2008,7 +2008,7 @@ 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=root(rel) at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2018,7 +2018,7 @@ 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=root in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2028,7 +2028,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2038,7 +2038,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >15/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2048,7 +2048,7 @@ 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=root(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2058,7 +2058,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2068,7 +2068,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2078,7 +2078,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2088,7 +2088,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2098,7 +2098,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2108,7 +2108,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2118,7 +2118,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2128,7 +2128,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2138,7 +2138,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2148,7 +2148,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2158,7 +2158,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2168,7 +2168,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2178,7 +2178,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2188,7 +2188,7 @@ 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+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2198,7 +2198,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2208,7 +2208,7 @@ 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+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -3151,7 +3151,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22/.git\n@@ -3162,7 +3162,7 @@ EOF\n \tGIT_DIR=.. test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22/.git\n@@ -3283,7 +3283,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n \tcat >22/.git/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3294,7 +3294,7 @@ EOF\n \tGIT_DIR=. test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n \tcat >22/.git/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3327,7 +3327,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3338,7 +3338,7 @@ EOF\n \tGIT_DIR=.. test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3392,7 +3392,7 @@ test_expect_success '#22.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.bare true\n '\n \n-test_expect_failure '#22.2: at .git' '\n+test_expect_success '#22.2: at .git' '\n \t(\n \tcd 22/.git &&\n \tGIT_DIR=. test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -3400,7 +3400,7 @@ test_expect_failure '#22.2: at .git' '\n \t)\n '\n \n-test_expect_failure '#22.2: at root' '\n+test_expect_success '#22.2: at root' '\n \t(\n \tcd 22 &&\n \tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -3800,7 +3800,7 @@ test_expect_success '#26: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#26: (rel) at root' '\n+test_expect_success '#26: (rel) at root' '\n \tcat >26/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3810,7 +3810,7 @@ EOF\n \t GIT_DIR=.git test_repo 26\n '\n \n-test_expect_failure '#26: at root' '\n+test_expect_success '#26: at root' '\n \tcat >26/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3820,7 +3820,7 @@ EOF\n \t GIT_DIR=\"$TRASH_DIRECTORY/26/.git\" test_repo 26\n '\n \n-test_expect_failure '#26: (rel) in subdir' '\n+test_expect_success '#26: (rel) in subdir' '\n \tcat >26/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3830,7 +3830,7 @@ EOF\n \tGIT_DIR=../.git test_repo 26/sub\n '\n \n-test_expect_failure '#26: in subdir' '\n+test_expect_success '#26: in subdir' '\n \tcat >26/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3868,7 +3868,7 @@ test_expect_success '#27: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3878,7 +3878,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3888,7 +3888,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3898,7 +3898,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3908,7 +3908,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3918,7 +3918,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3928,7 +3928,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >27/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3938,7 +3938,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3948,7 +3948,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3958,7 +3958,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3968,7 +3968,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3978,7 +3978,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=wt test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3988,7 +3988,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3998,7 +3998,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4008,7 +4008,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4018,7 +4018,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4028,7 +4028,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4038,7 +4038,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4048,7 +4048,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4058,7 +4058,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=.. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4068,7 +4068,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4078,7 +4078,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4088,7 +4088,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4098,7 +4098,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../../ test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4235,7 +4235,7 @@ test_expect_success '#30: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#30: at root' '\n+test_expect_success '#30: at root' '\n \t(\n \tcd 30 &&\n \tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -4272,7 +4272,7 @@ test_expect_success '#31: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4282,7 +4282,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4292,7 +4292,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4302,7 +4302,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4312,7 +4312,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4322,7 +4322,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4332,7 +4332,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >31/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4342,7 +4342,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4352,7 +4352,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4362,7 +4362,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4372,7 +4372,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4382,7 +4382,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=wt test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4392,7 +4392,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4402,7 +4402,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4412,7 +4412,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4422,7 +4422,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4432,7 +4432,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4442,7 +4442,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4452,7 +4452,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4462,7 +4462,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=.. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4472,7 +4472,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4482,7 +4482,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4492,7 +4492,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4502,7 +4502,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../../ test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n-- \n1.7.3.2.210.g045198\n"},{"id":"154915","messageId":"1288592794-24221-9-git-send-email-pclouds@gmail.com","threadId":"25587","inReplyTo":"AANLkTim-uW4Esk1bkPzNNGRb8svZoNwCUvXF3Fqb4QmR@mail.gmail.com","subject":"[PATCH 9/9] Remove all logic from get_git_work_tree()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-01T06:26:34Z","receivedAt":"2010-11-01T06:26:34Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This logic is now only used by cmd_init_db(). setup_* functions do not\nrely on it any more. Move all the logic to cmd_init_db() and turn\nget_git_work_tree() into a simple function.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/init-db.c |   14 +++++++++++---\n cache.h           |    1 -\n environment.c     |   26 ++------------------------\n 3 files changed, 13 insertions(+), 28 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex ea06478..e3af9ea 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -414,6 +414,7 @@ static const char *const init_db_usage[] = {\n int cmd_init_db(int argc, const char **argv, const char *prefix)\n {\n \tconst char *git_dir;\n+\tconst char *work_tree;\n \tconst char *template_dir = NULL;\n \tunsigned int flags = 0;\n \tconst struct option init_db_options[] = {\n@@ -480,8 +481,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t * without --bare.  Catch the error early.\n \t */\n \tgit_dir = getenv(GIT_DIR_ENVIRONMENT);\n-\tif ((!git_dir || is_bare_repository_cfg == 1)\n-\t    && getenv(GIT_WORK_TREE_ENVIRONMENT))\n+\twork_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);\n+\tif ((!git_dir || is_bare_repository_cfg == 1) && work_tree)\n \t\tdie(\"%s (or --work-tree=<directory>) not allowed without \"\n \t\t    \"specifying %s (or --git-dir=<directory>)\",\n \t\t    GIT_WORK_TREE_ENVIRONMENT,\n@@ -496,7 +497,6 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \tif (is_bare_repository_cfg < 0)\n \t\tis_bare_repository_cfg = guess_repository_type(git_dir);\n \n-\tstartup_info->setup_explicit = 1;\n \tif (!is_bare_repository_cfg) {\n \t\tif (git_dir) {\n \t\t\tconst char *git_dir_parent = strrchr(git_dir, '/');\n@@ -511,10 +511,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)\n \t\t\tif (!getcwd(git_work_tree_cfg, PATH_MAX))\n \t\t\t\tdie_errno (\"Cannot access current working directory\");\n \t\t}\n+\t\tif (work_tree)\n+\t\t\tset_git_work_tree(make_absolute_path(work_tree));\n+\t\telse\n+\t\t\tset_git_work_tree(git_work_tree_cfg);\n \t\tif (access(get_git_work_tree(), X_OK))\n \t\t\tdie_errno (\"Cannot access work tree '%s'\",\n \t\t\t\t   get_git_work_tree());\n \t}\n+\telse {\n+\t\tif (work_tree)\n+\t\t\tset_git_work_tree(make_absolute_path(work_tree));\n+\t}\n \n \tset_git_dir(make_absolute_path(git_dir));\n \ndiff --git a/cache.h b/cache.h\nindex b2cdda7..123dd4b 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1119,7 +1119,6 @@ const char *split_cmdline_strerror(int cmdline_errno);\n /* git.c */\n struct startup_info {\n \tint have_repository;\n-\tint setup_explicit;\n };\n extern struct startup_info *startup_info;\n \ndiff --git a/environment.c b/environment.c\nindex 15764ee..6db00da 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -137,36 +137,14 @@ static int git_work_tree_initialized;\n  */\n void set_git_work_tree(const char *new_work_tree)\n {\n+\tif (git_work_tree_initialized)\n+\t\tdie(\"internal error: work tree has already been set\");\n \tgit_work_tree_initialized = 1;\n-\tfree(work_tree);\n \twork_tree = xstrdup(make_absolute_path(new_work_tree));\n-\tis_bare_repository_cfg = 0;\n }\n \n const char *get_git_work_tree(void)\n {\n-\tif (startup_info && !startup_info->setup_explicit) {\n-\t\tif (is_bare_repository_cfg == 1)\n-\t\t\treturn NULL;\n-\t\tif (work_tree)\n-\t\t\tis_bare_repository_cfg = 0;\n-\t\treturn work_tree;\n-\t}\n-\n-\tif (!git_work_tree_initialized) {\n-\t\twork_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);\n-\t\t/* core.bare = true overrides implicit and config work tree */\n-\t\tif (!work_tree && is_bare_repository_cfg < 1) {\n-\t\t\twork_tree = git_work_tree_cfg;\n-\t\t\t/* make_absolute_path also normalizes the path */\n-\t\t\tif (work_tree && !is_absolute_path(work_tree))\n-\t\t\t\twork_tree = xstrdup(make_absolute_path(git_path(\"%s\", work_tree)));\n-\t\t} else if (work_tree)\n-\t\t\twork_tree = xstrdup(make_absolute_path(work_tree));\n-\t\tgit_work_tree_initialized = 1;\n-\t\tif (work_tree)\n-\t\t\tis_bare_repository_cfg = 0;\n-\t}\n \treturn work_tree;\n }\n \n-- \n1.7.3.2.210.g045198\n"}]}