{"thread":{"id":"25845","subject":"[PATCH 00/47] nd/setup updates on pu","startedAt":"2010-11-26T15:31:56Z","lastAt":"2011-01-26T05:07:15Z","messageCount":87,"participants":["Nguyễn Thái Ngọc Duy","Junio C Hamano","Nguyen Thai Ngoc Duy","Jonathan Nieder","Maaartin","Sverre Rabbelier","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":47},"messages":[{"id":"156631","messageId":"1290785563-15339-1-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":null,"subject":"[PATCH 00/47] nd/setup updates on pu","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:31:56Z","receivedAt":"2010-11-26T15:31:56Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Only tests are updated to eliminate bashisms. Tested on busybox ash.\n\nJonathan Nieder (2):\n  git-rev-parse.txt: clarify --git-dir\n  t0001: test git init when run via an alias\n\nMichael J Gruber (1):\n  t1020-subdirectory: test alias expansion in a subdirectory\n\nNguyễn Thái Ngọc Duy (44):\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  rev-parse: prints --git-dir relative to user's cwd\n  Add git_config_early()\n  Use git_config_early() instead of git_config() during repo setup\n  setup: limit get_git_work_tree()'s to explicit setup case only\n  setup: clean up setup_bare_git_dir()\n  setup: clean up setup_discovered_git_dir()\n  setup: rework setup_explicit_git_dir()\n  Remove all logic from get_git_work_tree()\n  Revert \"Documentation: always respect core.worktree if set\"\n  git.txt: correct where --work-tree path is relative to\n\n Documentation/config.txt        |   23 +-\n Documentation/git-rev-parse.txt |    7 +-\n Documentation/git.txt           |    2 +-\n builtin/init-db.c               |   13 +-\n builtin/rev-parse.c             |    6 +-\n cache.h                         |    2 +\n config.c                        |   19 +-\n environment.c                   |   26 +-\n git.c                           |    4 +\n setup.c                         |  230 ++-\n t/t0001-init.sh                 |   56 +\n t/t1020-subdirectory.sh         |    8 +\n t/t1510-repo-setup.sh           | 4532 +++++++++++++++++++++++++++++++++++++++\n trace.c                         |   42 +\n 14 files changed, 4835 insertions(+), 135 deletions(-)\n create mode 100755 t/t1510-repo-setup.sh\n\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156632","messageId":"1290785563-15339-2-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 01/47] builtins: print setup info if repo is found","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:31:57Z","receivedAt":"2010-11-26T15:31:57Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 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 0409ac9..6793178 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.3.2.316.gda8b3\n"},{"id":"156633","messageId":"1290785563-15339-3-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 02/47] Add t1510 and basic rules that run repo setup","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:31:58Z","receivedAt":"2010-11-26T15:31:58Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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.3.2.316.gda8b3\n"},{"id":"156634","messageId":"1290785563-15339-4-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 03/47] t1510: setup case #0","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:31:59Z","receivedAt":"2010-11-26T15:31:59Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   53 +++++++++++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 51 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 623807d..641731c 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -41,8 +41,10 @@ test_description='Tests of cwd/prefix/worktree/gitdir setup in all cases'\n \n test_repo() {\n \t(\n-\tif [ -n \"$1\" ]; then cd \"$1\"; fi &&\n-\tif [ -f trace ]; then rm trace; fi &&\n+\tcd \"$1\" &&\n+\tif [ -n \"$2\" ]; then GIT_DIR=\"$2\" && export GIT_DIR; fi &&\n+\tif [ -n \"$3\" ]; then GIT_WORK_TREE=\"$3\" && export GIT_WORK_TREE; fi &&\n+\trm -f trace &&\n \tGIT_TRACE=\"`pwd`/trace\" git symbolic-ref HEAD >/dev/null &&\n \tgrep '^setup: ' trace >result &&\n \ttest_cmp expected result\n@@ -56,4 +58,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.3.2.316.gda8b3\n"},{"id":"156635","messageId":"1290785563-15339-5-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 04/47] t1510: setup case #1","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:00Z","receivedAt":"2010-11-26T15:32:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 641731c..4e9c425 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -105,4 +105,51 @@ 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+\tGIT_WORK_TREE=non-existent &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156636","messageId":"1290785563-15339-6-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 05/47] t1510: setup case #2","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:01Z","receivedAt":"2010-11-26T15:32:01Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 4e9c425..febf9c4 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -152,4 +152,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+\ttest_repo 2 \"$TRASH_DIRECTORY/2/.git\"\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+\ttest_repo 2/sub \"$TRASH_DIRECTORY/2/.git\"\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+\ttest_repo 2 .git\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+\ttest_repo 2/sub ../.git\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156637","messageId":"1290785563-15339-7-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 06/47] t1510: setup case #3","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:02Z","receivedAt":"2010-11-26T15:32:02Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 febf9c4..9fff0b6 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -219,4 +219,271 @@ EOF\n \ttest_repo 2/sub ../.git\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+\ttest_repo 3 .git \"$TRASH_DIRECTORY/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+\ttest_repo 3 .git .\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+\ttest_repo 3 \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 3 \"$TRASH_DIRECTORY/3/.git\" .\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+\ttest_repo 3/sub/sub ../../.git \"$TRASH_DIRECTORY/3\"\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+\ttest_repo 3/sub/sub ../../.git ../..\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+\ttest_repo 3/sub \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY/3\"\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+\ttest_repo 3/sub/sub \"$TRASH_DIRECTORY/3/.git\" ../..\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+\ttest_repo 3 .git \"$TRASH_DIRECTORY/3/wt\"\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+\ttest_repo 3 .git wt\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+\ttest_repo 3 \"$TRASH_DIRECTORY/3/.git\" wt\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+\ttest_repo 3 \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY/3/wt\"\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+\ttest_repo 3/sub/sub ../../.git \"$TRASH_DIRECTORY/3/wt\"\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+\ttest_repo 3/sub/sub ../../.git ../../wt\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+\ttest_repo 3/sub/sub \"$TRASH_DIRECTORY/3/.git\" ../../wt\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+\ttest_repo 3/sub/sub \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY/3/wt\"\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+\ttest_repo 3 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 3 .git ..\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+\ttest_repo 3 \"$TRASH_DIRECTORY/3/.git\" ..\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+\ttest_repo 3 \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 3/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 3/sub/sub ../../.git ../../..\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+\ttest_repo 3/sub/sub \"$TRASH_DIRECTORY/3/.git\" ../../../\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+\ttest_repo 3/sub/sub \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156638","messageId":"1290785563-15339-8-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 07/47] t1510: setup case #4","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:03Z","receivedAt":"2010-11-26T15:32:03Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 9fff0b6..655f603 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -486,4 +486,50 @@ EOF\n \ttest_repo 3/sub/sub \"$TRASH_DIRECTORY/3/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156639","messageId":"1290785563-15339-9-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 08/47] t1510: setup case #5","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:04Z","receivedAt":"2010-11-26T15:32:04Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 655f603..369f237 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -532,4 +532,52 @@ 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+\tGIT_WORK_TREE=non-existent-too &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156640","messageId":"1290785563-15339-10-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 09/47] t1510: setup case #6","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:05Z","receivedAt":"2010-11-26T15:32:05Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 369f237..4b2e60e 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -580,4 +580,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+\ttest_repo 6 .git\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+\ttest_repo 6 .git\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+\ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6/sub/sub ../../.git\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+\ttest_repo 6/sub/sub ../../.git\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+\ttest_repo 6/sub \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6 .git\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+\ttest_repo 6 .git\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+\ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6/sub/sub ../../.git\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+\ttest_repo 6/sub/sub ../../.git\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+\ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6 .git\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+\ttest_repo 6 .git\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+\ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6/sub/sub ../../.git\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+\ttest_repo 6/sub/sub ../../.git\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+\ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156641","messageId":"1290785563-15339-11-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 10/47] t1510: setup case #7","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:06Z","receivedAt":"2010-11-26T15:32:06Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 4b2e60e..ccd7036 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -871,4 +871,270 @@ EOF\n \ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\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+\ttest_repo 7 .git \"$TRASH_DIRECTORY/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+\ttest_repo 7 .git .\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+\ttest_repo 7 \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 7 \"$TRASH_DIRECTORY/7/.git\" .\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+\ttest_repo 7/sub/sub ../../.git \"$TRASH_DIRECTORY/7\"\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+\ttest_repo 7/sub/sub ../../.git ../..\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+\ttest_repo 7/sub \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY/7\"\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+\ttest_repo 7/sub/sub \"$TRASH_DIRECTORY/7/.git\" ../..\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+\ttest_repo 7 .git \"$TRASH_DIRECTORY/7/wt\"\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+\ttest_repo 7 .git wt\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+\ttest_repo 7 \"$TRASH_DIRECTORY/7/.git\" wt\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+\ttest_repo 7 \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY/7/wt\"\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+\ttest_repo 7/sub/sub ../../.git \"$TRASH_DIRECTORY/7/wt\"\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+\ttest_repo 7/sub/sub ../../.git ../../wt\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+\ttest_repo 7/sub/sub \"$TRASH_DIRECTORY/7/.git\" ../../wt\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+\ttest_repo 7/sub/sub \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY/7/wt\"\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+\ttest_repo 7 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 7 .git ..\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+\ttest_repo 7 \"$TRASH_DIRECTORY/7/.git\" ..\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+\ttest_repo 7 \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 7/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 7/sub/sub ../../.git ../../..\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+\ttest_repo 7/sub/sub \"$TRASH_DIRECTORY/7/.git\" ../../../\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+\ttest_repo 7/sub/sub \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156642","messageId":"1290785563-15339-12-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 11/47] t1510: setup case #8","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:07Z","receivedAt":"2010-11-26T15:32:07Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 ccd7036..d1601e8 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1137,4 +1137,51 @@ EOF\n \ttest_repo 7/sub/sub \"$TRASH_DIRECTORY/7/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156643","messageId":"1290785563-15339-13-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 12/47] t1510: setup case #9","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:08Z","receivedAt":"2010-11-26T15:32:08Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 d1601e8..e258869 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1184,4 +1184,53 @@ 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+\tGIT_WORK_TREE=non-existent &&\n+\texport GIT_WORK_TREE &&\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+\ttest_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+\ttest_repo 9/sub\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156645","messageId":"1290785563-15339-14-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 13/47] t1510: setup case #10","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:09Z","receivedAt":"2010-11-26T15:32:09Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 e258869..3f19ff1 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1233,4 +1233,71 @@ EOF\n \ttest_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+\ttest_repo 10 \"$TRASH_DIRECTORY/10/.git\"\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+\ttest_repo 10/sub \"$TRASH_DIRECTORY/10/.git\"\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+\ttest_repo 10 .git\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+\ttest_repo 10/sub ../.git\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156644","messageId":"1290785563-15339-15-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 14/47] t1510: setup case #11","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:10Z","receivedAt":"2010-11-26T15:32:10Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 3f19ff1..ac95808 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1300,4 +1300,271 @@ EOF\n \ttest_repo 10/sub ../.git\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+\ttest_repo 11 .git \"$TRASH_DIRECTORY/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+\ttest_repo 11 .git .\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+\ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" .\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+\ttest_repo 11/sub/sub ../../.git \"$TRASH_DIRECTORY/11\"\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+\ttest_repo 11/sub/sub ../../.git ../..\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+\ttest_repo 11/sub \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/11\"\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+\ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" ../..\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+\ttest_repo 11 .git \"$TRASH_DIRECTORY/11/wt\"\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+\ttest_repo 11 .git wt\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+\ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" wt\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+\ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/11/wt\"\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+\ttest_repo 11/sub/sub ../../.git \"$TRASH_DIRECTORY/11/wt\"\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+\ttest_repo 11/sub/sub ../../.git ../../wt\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+\ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" ../../wt\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+\ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/11/wt\"\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+\ttest_repo 11 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 11 .git ..\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+\ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" ..\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+\ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 11/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 11/sub/sub ../../.git ../../..\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+\ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" ../../../\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+\ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156646","messageId":"1290785563-15339-16-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 15/47] t1510: setup case #12","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:11Z","receivedAt":"2010-11-26T15:32:11Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 ac95808..b86895f 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1567,4 +1567,53 @@ EOF\n \ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156647","messageId":"1290785563-15339-17-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 16/47] t1510: setup case #13","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:12Z","receivedAt":"2010-11-26T15:32:12Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   50 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 50 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex b86895f..c2cc504 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1616,4 +1616,54 @@ 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+\tGIT_WORK_TREE=non-existent-too &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156648","messageId":"1290785563-15339-18-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 17/47] t1510: setup case #14","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:13Z","receivedAt":"2010-11-26T15:32:13Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 c2cc504..617a14d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1666,4 +1666,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+\ttest_repo 14 .git\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+\ttest_repo 14 .git\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+\ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14/sub/sub ../../.git\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+\ttest_repo 14/sub/sub ../../.git\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+\ttest_repo 14/sub \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14 .git\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+\ttest_repo 14 .git\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+\ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14/sub/sub ../../.git\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+\ttest_repo 14/sub/sub ../../.git\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+\ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14 .git\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+\ttest_repo 14 .git\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+\ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14/sub/sub ../../.git\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+\ttest_repo 14/sub/sub ../../.git\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+\ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156649","messageId":"1290785563-15339-19-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 18/47] t1510: setup case #15","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:14Z","receivedAt":"2010-11-26T15:32:14Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 617a14d..732053d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1957,4 +1957,272 @@ EOF\n \ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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+\ttest_repo 15 .git \"$TRASH_DIRECTORY/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+\ttest_repo 15 .git .\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+\ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" .\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+\ttest_repo 15/sub/sub ../../.git \"$TRASH_DIRECTORY/15\"\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+\ttest_repo 15/sub/sub ../../.git ../..\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+\ttest_repo 15/sub \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/15\"\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+\ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" ../..\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+\ttest_repo 15 .git \"$TRASH_DIRECTORY/15/wt\"\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+\ttest_repo 15 .git wt\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+\ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" wt\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+\ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/15/wt\"\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+\ttest_repo 15/sub/sub ../../.git \"$TRASH_DIRECTORY/15/wt\"\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+\ttest_repo 15/sub/sub ../../.git ../../wt\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+\ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" ../../wt\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+\ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/15/wt\"\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+\ttest_repo 15 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 15 .git ..\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+\ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" ..\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+\ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 15/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 15/sub/sub ../../.git ../../..\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+\ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" ../../../\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+\ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156650","messageId":"1290785563-15339-20-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 19/47] t1510: setup case #16","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:15Z","receivedAt":"2010-11-26T15:32:15Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 732053d..0f7a2d9 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2225,4 +2225,139 @@ EOF\n \ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156651","messageId":"1290785563-15339-21-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 20/47] t1510: setup case #17","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:16Z","receivedAt":"2010-11-26T15:32:16Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 0f7a2d9..e298a16 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2360,4 +2360,133 @@ 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+\tGIT_WORK_TREE=non-existent &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156652","messageId":"1290785563-15339-22-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 21/47] t1510: setup case #18","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:17Z","receivedAt":"2010-11-26T15:32:17Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 e298a16..069af70 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2489,4 +2489,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 test_repo 18 .git\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 test_repo 18 \"$TRASH_DIRECTORY/18/.git\"\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+\ttest_repo 18/sub ../.git\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+\ttest_repo 18/sub \"$TRASH_DIRECTORY/18/.git\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156653","messageId":"1290785563-15339-23-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 22/47] t1510: setup case #19","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:18Z","receivedAt":"2010-11-26T15:32:18Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 069af70..954e7fe 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2560,4 +2560,270 @@ EOF\n \ttest_repo 18/sub \"$TRASH_DIRECTORY/18/.git\"\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+\ttest_repo 19 .git \"$TRASH_DIRECTORY/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+\ttest_repo 19 .git .\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+\ttest_repo 19 \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 19 \"$TRASH_DIRECTORY/19/.git\" .\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+\ttest_repo 19/sub/sub ../../.git \"$TRASH_DIRECTORY/19\"\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+\ttest_repo 19/sub/sub ../../.git ../..\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+\ttest_repo 19/sub \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY/19\"\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+\ttest_repo 19/sub/sub \"$TRASH_DIRECTORY/19/.git\" ../..\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+\ttest_repo 19 .git \"$TRASH_DIRECTORY/19/wt\"\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+\ttest_repo 19 .git wt\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+\ttest_repo 19 \"$TRASH_DIRECTORY/19/.git\" wt\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+\ttest_repo 19 \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY/19/wt\"\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+\ttest_repo 19/sub/sub ../../.git \"$TRASH_DIRECTORY/19/wt\"\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+\ttest_repo 19/sub/sub ../../.git ../../wt\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+\ttest_repo 19/sub/sub \"$TRASH_DIRECTORY/19/.git\" ../../wt\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+\ttest_repo 19/sub/sub \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY/19/wt\"\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+\ttest_repo 19 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 19 .git ..\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+\ttest_repo 19 \"$TRASH_DIRECTORY/19/.git\" ..\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+\ttest_repo 19 \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 19/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 19/sub/sub ../../.git ../../..\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+\ttest_repo 19/sub/sub \"$TRASH_DIRECTORY/19/.git\" ../../../\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+\ttest_repo 19/sub/sub \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156654","messageId":"1290785563-15339-24-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 23/47] t1510: setup case #20","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:19Z","receivedAt":"2010-11-26T15:32:19Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 954e7fe..db52f36 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2826,4 +2826,132 @@ EOF\n \ttest_repo 19/sub/sub \"$TRASH_DIRECTORY/19/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156655","messageId":"1290785563-15339-25-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 24/47] t1510: setup case #21","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:20Z","receivedAt":"2010-11-26T15:32:20Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  130 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 130 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex db52f36..47d6c4b 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2954,4 +2954,134 @@ 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+\tGIT_WORK_TREE=non-existent-too &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156656","messageId":"1290785563-15339-26-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 25/47] t1510: setup case #22","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:21Z","receivedAt":"2010-11-26T15:32:21Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |  337 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 337 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 47d6c4b..0027274 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3084,4 +3084,341 @@ 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+\ttest_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+\ttest_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+\ttest_repo 22/.git \"$TRASH_DIRECTORY/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+\ttest_repo 22/.git \"$TRASH_DIRECTORY/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+\ttest_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+\ttest_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+\ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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+\ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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+\ttest_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+\ttest_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+\ttest_repo 22/.git \"$TRASH_DIRECTORY/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+\ttest_repo 22/.git \"$TRASH_DIRECTORY/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+\ttest_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+\ttest_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+\ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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+\ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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+\ttest_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+\ttest_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+\ttest_repo 22/.git \"$TRASH_DIRECTORY/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+\ttest_repo 22/.git \"$TRASH_DIRECTORY/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+\ttest_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+\ttest_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+\ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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+\ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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=. &&\n+\texport GIT_DIR &&\n+\ttest_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 &&\n+\texport GIT_DIR &&\n+\ttest_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.3.2.316.gda8b3\n"},{"id":"156657","messageId":"1290785563-15339-27-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 26/47] t1510: setup case #23","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:22Z","receivedAt":"2010-11-26T15:32:22Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 0027274..07af3cc 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3421,4 +3421,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+\ttest_repo 23 .git \"$TRASH_DIRECTORY/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+\ttest_repo 23 .git .\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+\ttest_repo 23 \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 23 \"$TRASH_DIRECTORY/23/.git\" .\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+\ttest_repo 23/sub/sub ../../.git \"$TRASH_DIRECTORY/23\"\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+\ttest_repo 23/sub/sub ../../.git ../..\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+\ttest_repo 23/sub \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY/23\"\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+\ttest_repo 23/sub/sub \"$TRASH_DIRECTORY/23/.git\" ../..\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+\ttest_repo 23 .git \"$TRASH_DIRECTORY/23/wt\"\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+\ttest_repo 23 .git wt\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+\ttest_repo 23 \"$TRASH_DIRECTORY/23/.git\" wt\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+\ttest_repo 23 \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY/23/wt\"\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+\ttest_repo 23/sub/sub ../../.git \"$TRASH_DIRECTORY/23/wt\"\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+\ttest_repo 23/sub/sub ../../.git ../../wt\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+\ttest_repo 23/sub/sub \"$TRASH_DIRECTORY/23/.git\" ../../wt\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+\ttest_repo 23/sub/sub \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY/23/wt\"\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+\ttest_repo 23 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 23 .git ..\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+\ttest_repo 23 \"$TRASH_DIRECTORY/23/.git\" ..\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+\ttest_repo 23 \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 23/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 23/sub/sub ../../.git ../../..\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+\ttest_repo 23/sub/sub \"$TRASH_DIRECTORY/23/.git\" ../../../\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+\ttest_repo 23/sub/sub \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156658","messageId":"1290785563-15339-28-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 27/47] t1510: setup case #24","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:23Z","receivedAt":"2010-11-26T15:32:23Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 07af3cc..1c89366 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3688,4 +3688,52 @@ EOF\n \ttest_repo 23/sub/sub \"$TRASH_DIRECTORY/23/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156659","messageId":"1290785563-15339-29-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 28/47] t1510: setup case #25","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:24Z","receivedAt":"2010-11-26T15:32:24Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   50 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 50 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 1c89366..fa1ffac 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3736,4 +3736,54 @@ 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+\tGIT_WORK_TREE=non-existent &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156660","messageId":"1290785563-15339-30-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 29/47] t1510: setup case #26","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:25Z","receivedAt":"2010-11-26T15:32:25Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 fa1ffac..0ad5e81 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3786,4 +3786,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 test_repo 26 .git\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 test_repo 26 \"$TRASH_DIRECTORY/26/.git\"\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+\ttest_repo 26/sub ../.git\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+\ttest_repo 26/sub \"$TRASH_DIRECTORY/26/.git\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156661","messageId":"1290785563-15339-31-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 30/47] t1510: setup case #27","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:26Z","receivedAt":"2010-11-26T15:32:26Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 0ad5e81..5c831d1 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -3854,4 +3854,272 @@ EOF\n \ttest_repo 26/sub \"$TRASH_DIRECTORY/26/.git\"\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+\ttest_repo 27 .git \"$TRASH_DIRECTORY/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+\ttest_repo 27 .git .\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+\ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" .\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+\ttest_repo 27/sub/sub ../../.git \"$TRASH_DIRECTORY/27\"\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+\ttest_repo 27/sub/sub ../../.git ../..\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+\ttest_repo 27/sub \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/27\"\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+\ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" ../..\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+\ttest_repo 27 .git \"$TRASH_DIRECTORY/27/wt\"\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+\ttest_repo 27 .git wt\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+\ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" wt\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+\ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/27/wt\"\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+\ttest_repo 27/sub/sub ../../.git \"$TRASH_DIRECTORY/27/wt\"\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+\ttest_repo 27/sub/sub ../../.git ../../wt\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+\ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" ../../wt\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+\ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/27/wt\"\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+\ttest_repo 27 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 27 .git ..\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+\ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" ..\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+\ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 27/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 27/sub/sub ../../.git ../../..\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+\ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" ../../../\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+\ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156662","messageId":"1290785563-15339-32-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 31/47] t1510: setup case #28","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:27Z","receivedAt":"2010-11-26T15:32:27Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 5c831d1..d845758 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4122,4 +4122,53 @@ EOF\n \ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY\"\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.3.2.316.gda8b3\n"},{"id":"156676","messageId":"1290785563-15339-33-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 32/47] t1510: setup case #29","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:28Z","receivedAt":"2010-11-26T15:32:28Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   50 +++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 50 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex d845758..2d1982f 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4171,4 +4171,54 @@ 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+\tGIT_WORK_TREE=non-existent &&\n+\texport GIT_WORK_TREE &&\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.3.2.316.gda8b3\n"},{"id":"156663","messageId":"1290785563-15339-34-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 33/47] t1510: setup case #30","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:29Z","receivedAt":"2010-11-26T15:32:29Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/t1510-repo-setup.sh |   39 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 39 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 2d1982f..96f7485 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4221,4 +4221,43 @@ 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 &&\n+\texport GIT_DIR &&\n+\ttest_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.3.2.316.gda8b3\n"},{"id":"156675","messageId":"1290785563-15339-35-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 34/47] t1510: setup case #31","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:30Z","receivedAt":"2010-11-26T15:32:30Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-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 96f7485..d8c181d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -4260,4 +4260,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+\ttest_repo 31 .git \"$TRASH_DIRECTORY/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+\ttest_repo 31 .git .\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+\ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/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+\ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" .\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+\ttest_repo 31/sub/sub ../../.git \"$TRASH_DIRECTORY/31\"\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+\ttest_repo 31/sub/sub ../../.git ../..\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+\ttest_repo 31/sub \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/31\"\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+\ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" ../..\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+\ttest_repo 31 .git \"$TRASH_DIRECTORY/31/wt\"\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+\ttest_repo 31 .git wt\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+\ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" wt\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+\ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/31/wt\"\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+\ttest_repo 31/sub/sub ../../.git \"$TRASH_DIRECTORY/31/wt\"\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+\ttest_repo 31/sub/sub ../../.git ../../wt\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+\ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" ../../wt\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+\ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/31/wt\"\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+\ttest_repo 31 .git \"$TRASH_DIRECTORY\"\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+\ttest_repo 31 .git ..\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+\ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" ..\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+\ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY\"\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+\ttest_repo 31/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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+\ttest_repo 31/sub/sub ../../.git ../../..\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+\ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" ../../../\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+\ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY\"\n+'\n+\n test_done\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156677","messageId":"1290785563-15339-36-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 35/47] git-rev-parse.txt: clarify --git-dir","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:31Z","receivedAt":"2010-11-26T15:32:31Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\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 4a27643..ff23cb0 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.316.gda8b3\n"},{"id":"156664","messageId":"1290785563-15339-37-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 36/47] 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-26T15:32:32Z","receivedAt":"2010-11-26T15:32:32Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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.3.2.316.gda8b3\n"},{"id":"156665","messageId":"1290785563-15339-38-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 37/47] Add git_config_early()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:33Z","receivedAt":"2010-11-26T15:32:33Z","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.3.2.316.gda8b3\n"},{"id":"156673","messageId":"1290785563-15339-39-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 38/47] 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-26T15:32:34Z","receivedAt":"2010-11-26T15:32:34Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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.3.2.316.gda8b3\n"},{"id":"156678","messageId":"1290785563-15339-40-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 39/47] 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-26T15:32:35Z","receivedAt":"2010-11-26T15:32:35Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\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 d8c181d..45feb80 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -132,7 +132,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@@ -142,7 +142,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@@ -512,7 +512,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@@ -522,7 +522,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@@ -560,7 +560,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@@ -570,7 +570,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@@ -1213,7 +1213,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@@ -1223,7 +1223,7 @@ EOF\n \ttest_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@@ -1596,7 +1596,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@@ -1606,7 +1606,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@@ -1646,7 +1646,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@@ -1656,7 +1656,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@@ -2388,7 +2388,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@@ -2398,7 +2398,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@@ -2408,7 +2408,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@@ -2439,7 +2439,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@@ -2449,7 +2449,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@@ -2459,7 +2459,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@@ -2469,7 +2469,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@@ -2853,7 +2853,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@@ -2863,7 +2863,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@@ -2873,7 +2873,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@@ -2983,7 +2983,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@@ -2993,7 +2993,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@@ -3003,7 +3003,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@@ -3034,7 +3034,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@@ -3044,7 +3044,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@@ -3054,7 +3054,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@@ -3064,7 +3064,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@@ -3716,7 +3716,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@@ -3726,7 +3726,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@@ -4151,7 +4151,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@@ -4161,7 +4161,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.316.gda8b3\n"},{"id":"156666","messageId":"1290785563-15339-41-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 40/47] setup: clean up setup_bare_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:36Z","receivedAt":"2010-11-26T15:32:36Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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.316.gda8b3\n"},{"id":"156667","messageId":"1290785563-15339-42-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 41/47] t1020-subdirectory: test alias expansion in a subdirectory","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:37Z","receivedAt":"2010-11-26T15:32:37Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"From: Michael J Gruber <git@drmicha.warpmail.net>\n\nAdd a test for alias expansion in a subdirectory of the worktree.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1020-subdirectory.sh |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh\nindex a3ac338..1fd187c 100755\n--- a/t/t1020-subdirectory.sh\n+++ b/t/t1020-subdirectory.sh\n@@ -110,6 +110,14 @@ test_expect_success 'read-tree' '\n \t)\n '\n \n+test_expect_success 'alias expansion' '\n+\t(\n+\t\tgit config alias.ss status &&\n+\t\tcd dir &&\n+\t\tgit status &&\n+\t\tgit ss\n+\t)\n+'\n test_expect_success 'no file/rev ambiguity check inside .git' '\n \tgit commit -a -m 1 &&\n \t(\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156668","messageId":"1290785563-15339-43-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 42/47] setup: clean up setup_discovered_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:38Z","receivedAt":"2010-11-26T15:32:38Z","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\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n setup.c               |   72 ++++++++++++++++++++++++------------------------\n t/t1510-repo-setup.sh |   24 ++++++++--------\n 2 files changed, 48 insertions(+), 48 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex a6cc044..3ee9c2e 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -362,39 +362,27 @@ 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+\tif (strcmp(gitdir, DEFAULT_GIT_DIR_ENVIRONMENT))\n+\t\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 +444,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 +490,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 45feb80..5ae02ee 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2350,7 +2350,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@@ -2479,7 +2479,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@@ -2944,7 +2944,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@@ -3074,7 +3074,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@@ -3716,7 +3716,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@@ -3726,7 +3726,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@@ -3766,7 +3766,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@@ -3776,7 +3776,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@@ -4151,7 +4151,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@@ -4161,7 +4161,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@@ -4201,7 +4201,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@@ -4211,7 +4211,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.316.gda8b3\n"},{"id":"156679","messageId":"1290785563-15339-44-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 43/47] setup: rework setup_explicit_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:39Z","receivedAt":"2010-11-26T15:32:39Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.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 3ee9c2e..2e2865c 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@@ -441,7 +475,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@@ -458,6 +491,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@@ -465,10 +502,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@@ -485,7 +519,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@@ -628,20 +661,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 5ae02ee..b7e4d5d 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -651,7 +651,7 @@ EOF\n \ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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@@ -662,7 +662,7 @@ EOF\n \ttest_repo 6/sub/sub ../../.git\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@@ -783,7 +783,7 @@ EOF\n \ttest_repo 6/sub/sub \"$TRASH_DIRECTORY/6/.git\"\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@@ -794,7 +794,7 @@ EOF\n \ttest_repo 6 .git\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@@ -827,7 +827,7 @@ EOF\n \ttest_repo 6 \"$TRASH_DIRECTORY/6/.git\"\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@@ -838,7 +838,7 @@ EOF\n \ttest_repo 6/sub/sub ../../.git\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@@ -1260,7 +1260,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@@ -1270,7 +1270,7 @@ EOF\n \ttest_repo 10 \"$TRASH_DIRECTORY/10/.git\"\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@@ -1280,7 +1280,7 @@ EOF\n \ttest_repo 10/sub \"$TRASH_DIRECTORY/10/.git\"\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@@ -1290,7 +1290,7 @@ EOF\n \ttest_repo 10 .git\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@@ -1327,7 +1327,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@@ -1337,7 +1337,7 @@ EOF\n \ttest_repo 11 .git \"$TRASH_DIRECTORY/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@@ -1347,7 +1347,7 @@ EOF\n \ttest_repo 11 .git .\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@@ -1357,7 +1357,7 @@ EOF\n \ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/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@@ -1367,7 +1367,7 @@ EOF\n \ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" .\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@@ -1377,7 +1377,7 @@ EOF\n \ttest_repo 11/sub/sub ../../.git \"$TRASH_DIRECTORY/11\"\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@@ -1387,7 +1387,7 @@ EOF\n \ttest_repo 11/sub/sub ../../.git ../..\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@@ -1397,7 +1397,7 @@ EOF\n \ttest_repo 11/sub \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/11\"\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@@ -1407,7 +1407,7 @@ EOF\n \ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" ../..\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@@ -1417,7 +1417,7 @@ EOF\n \ttest_repo 11 .git \"$TRASH_DIRECTORY/11/wt\"\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@@ -1427,7 +1427,7 @@ EOF\n \ttest_repo 11 .git wt\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@@ -1437,7 +1437,7 @@ EOF\n \ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" wt\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@@ -1447,7 +1447,7 @@ EOF\n \ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/11/wt\"\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@@ -1457,7 +1457,7 @@ EOF\n \ttest_repo 11/sub/sub ../../.git \"$TRASH_DIRECTORY/11/wt\"\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@@ -1467,7 +1467,7 @@ EOF\n \ttest_repo 11/sub/sub ../../.git ../../wt\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@@ -1477,7 +1477,7 @@ EOF\n \ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" ../../wt\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@@ -1487,7 +1487,7 @@ EOF\n \ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY/11/wt\"\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@@ -1497,7 +1497,7 @@ EOF\n \ttest_repo 11 .git \"$TRASH_DIRECTORY\"\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@@ -1507,7 +1507,7 @@ EOF\n \ttest_repo 11 .git ..\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@@ -1517,7 +1517,7 @@ EOF\n \ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" ..\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@@ -1527,7 +1527,7 @@ EOF\n \ttest_repo 11 \"$TRASH_DIRECTORY/11/.git\" \"$TRASH_DIRECTORY\"\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@@ -1537,7 +1537,7 @@ EOF\n \ttest_repo 11/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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@@ -1547,7 +1547,7 @@ EOF\n \ttest_repo 11/sub/sub ../../.git ../../..\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@@ -1557,7 +1557,7 @@ EOF\n \ttest_repo 11/sub/sub \"$TRASH_DIRECTORY/11/.git\" ../../../\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@@ -1693,7 +1693,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@@ -1704,7 +1704,7 @@ EOF\n \ttest_repo 14 .git\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@@ -1715,7 +1715,7 @@ EOF\n \ttest_repo 14 .git\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@@ -1726,7 +1726,7 @@ EOF\n \ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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@@ -1737,7 +1737,7 @@ EOF\n \ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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@@ -1748,7 +1748,7 @@ EOF\n \ttest_repo 14/sub/sub ../../.git\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@@ -1759,7 +1759,7 @@ EOF\n \ttest_repo 14/sub/sub ../../.git\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@@ -1770,7 +1770,7 @@ EOF\n \ttest_repo 14/sub \"$TRASH_DIRECTORY/14/.git\"\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@@ -1781,7 +1781,7 @@ EOF\n \ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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@@ -1792,7 +1792,7 @@ EOF\n \ttest_repo 14 .git\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@@ -1803,7 +1803,7 @@ EOF\n \ttest_repo 14 .git\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@@ -1814,7 +1814,7 @@ EOF\n \ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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@@ -1825,7 +1825,7 @@ EOF\n \ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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@@ -1836,7 +1836,7 @@ EOF\n \ttest_repo 14/sub/sub ../../.git\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@@ -1847,7 +1847,7 @@ EOF\n \ttest_repo 14/sub/sub ../../.git\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@@ -1858,7 +1858,7 @@ EOF\n \ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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@@ -1869,7 +1869,7 @@ EOF\n \ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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@@ -1880,7 +1880,7 @@ EOF\n \ttest_repo 14 .git\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@@ -1891,7 +1891,7 @@ EOF\n \ttest_repo 14 .git\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@@ -1902,7 +1902,7 @@ EOF\n \ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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@@ -1913,7 +1913,7 @@ EOF\n \ttest_repo 14 \"$TRASH_DIRECTORY/14/.git\"\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@@ -1924,7 +1924,7 @@ EOF\n \ttest_repo 14/sub/sub ../../.git\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@@ -1935,7 +1935,7 @@ EOF\n \ttest_repo 14/sub/sub ../../.git\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@@ -1946,7 +1946,7 @@ EOF\n \ttest_repo 14/sub/sub \"$TRASH_DIRECTORY/14/.git\"\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@@ -1985,7 +1985,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@@ -1995,7 +1995,7 @@ EOF\n \ttest_repo 15 .git \"$TRASH_DIRECTORY/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@@ -2005,7 +2005,7 @@ EOF\n \ttest_repo 15 .git .\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@@ -2015,7 +2015,7 @@ EOF\n \ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/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@@ -2025,7 +2025,7 @@ EOF\n \ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" .\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@@ -2035,7 +2035,7 @@ EOF\n \ttest_repo 15/sub/sub ../../.git \"$TRASH_DIRECTORY/15\"\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@@ -2045,7 +2045,7 @@ EOF\n \ttest_repo 15/sub/sub ../../.git ../..\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@@ -2055,7 +2055,7 @@ EOF\n \ttest_repo 15/sub \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/15\"\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@@ -2065,7 +2065,7 @@ EOF\n \ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" ../..\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@@ -2075,7 +2075,7 @@ EOF\n \ttest_repo 15 .git \"$TRASH_DIRECTORY/15/wt\"\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@@ -2085,7 +2085,7 @@ EOF\n \ttest_repo 15 .git wt\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@@ -2095,7 +2095,7 @@ EOF\n \ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" wt\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@@ -2105,7 +2105,7 @@ EOF\n \ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/15/wt\"\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@@ -2115,7 +2115,7 @@ EOF\n \ttest_repo 15/sub/sub ../../.git \"$TRASH_DIRECTORY/15/wt\"\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@@ -2125,7 +2125,7 @@ EOF\n \ttest_repo 15/sub/sub ../../.git ../../wt\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@@ -2135,7 +2135,7 @@ EOF\n \ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" ../../wt\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@@ -2145,7 +2145,7 @@ EOF\n \ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY/15/wt\"\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@@ -2155,7 +2155,7 @@ EOF\n \ttest_repo 15 .git \"$TRASH_DIRECTORY\"\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@@ -2165,7 +2165,7 @@ EOF\n \ttest_repo 15 .git ..\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@@ -2175,7 +2175,7 @@ EOF\n \ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" ..\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@@ -2185,7 +2185,7 @@ EOF\n \ttest_repo 15 \"$TRASH_DIRECTORY/15/.git\" \"$TRASH_DIRECTORY\"\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@@ -2195,7 +2195,7 @@ EOF\n \ttest_repo 15/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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@@ -2205,7 +2205,7 @@ EOF\n \ttest_repo 15/sub/sub ../../.git ../../..\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@@ -2215,7 +2215,7 @@ EOF\n \ttest_repo 15/sub/sub \"$TRASH_DIRECTORY/15/.git\" ../../../\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@@ -3160,7 +3160,7 @@ EOF\n \ttest_repo 22/.git \"$TRASH_DIRECTORY/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@@ -3171,7 +3171,7 @@ EOF\n \ttest_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@@ -3292,7 +3292,7 @@ EOF\n \ttest_repo 22/.git/sub \"$TRASH_DIRECTORY/22/.git\"\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@@ -3303,7 +3303,7 @@ EOF\n \ttest_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@@ -3336,7 +3336,7 @@ EOF\n \ttest_repo 22/.git \"$TRASH_DIRECTORY/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@@ -3347,7 +3347,7 @@ EOF\n \ttest_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@@ -3401,7 +3401,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=. &&\n@@ -3411,7 +3411,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 &&\n@@ -3814,7 +3814,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@@ -3824,7 +3824,7 @@ EOF\n \t test_repo 26 .git\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@@ -3834,7 +3834,7 @@ EOF\n \t test_repo 26 \"$TRASH_DIRECTORY/26/.git\"\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@@ -3844,7 +3844,7 @@ EOF\n \ttest_repo 26/sub ../.git\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@@ -3882,7 +3882,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@@ -3892,7 +3892,7 @@ EOF\n \ttest_repo 27 .git \"$TRASH_DIRECTORY/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@@ -3902,7 +3902,7 @@ EOF\n \ttest_repo 27 .git .\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@@ -3912,7 +3912,7 @@ EOF\n \ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/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@@ -3922,7 +3922,7 @@ EOF\n \ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" .\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@@ -3932,7 +3932,7 @@ EOF\n \ttest_repo 27/sub/sub ../../.git \"$TRASH_DIRECTORY/27\"\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@@ -3942,7 +3942,7 @@ EOF\n \ttest_repo 27/sub/sub ../../.git ../..\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@@ -3952,7 +3952,7 @@ EOF\n \ttest_repo 27/sub \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/27\"\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@@ -3962,7 +3962,7 @@ EOF\n \ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" ../..\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@@ -3972,7 +3972,7 @@ EOF\n \ttest_repo 27 .git \"$TRASH_DIRECTORY/27/wt\"\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@@ -3982,7 +3982,7 @@ EOF\n \ttest_repo 27 .git wt\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@@ -3992,7 +3992,7 @@ EOF\n \ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" wt\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@@ -4002,7 +4002,7 @@ EOF\n \ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/27/wt\"\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@@ -4012,7 +4012,7 @@ EOF\n \ttest_repo 27/sub/sub ../../.git \"$TRASH_DIRECTORY/27/wt\"\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@@ -4022,7 +4022,7 @@ EOF\n \ttest_repo 27/sub/sub ../../.git ../../wt\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@@ -4032,7 +4032,7 @@ EOF\n \ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" ../../wt\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@@ -4042,7 +4042,7 @@ EOF\n \ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY/27/wt\"\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@@ -4052,7 +4052,7 @@ EOF\n \ttest_repo 27 .git \"$TRASH_DIRECTORY\"\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@@ -4062,7 +4062,7 @@ EOF\n \ttest_repo 27 .git ..\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@@ -4072,7 +4072,7 @@ EOF\n \ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" ..\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@@ -4082,7 +4082,7 @@ EOF\n \ttest_repo 27 \"$TRASH_DIRECTORY/27/.git\" \"$TRASH_DIRECTORY\"\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@@ -4092,7 +4092,7 @@ EOF\n \ttest_repo 27/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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@@ -4102,7 +4102,7 @@ EOF\n \ttest_repo 27/sub/sub ../../.git ../../..\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@@ -4112,7 +4112,7 @@ EOF\n \ttest_repo 27/sub/sub \"$TRASH_DIRECTORY/27/.git\" ../../../\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@@ -4250,7 +4250,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 &&\n@@ -4289,7 +4289,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@@ -4299,7 +4299,7 @@ EOF\n \ttest_repo 31 .git \"$TRASH_DIRECTORY/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@@ -4309,7 +4309,7 @@ EOF\n \ttest_repo 31 .git .\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@@ -4319,7 +4319,7 @@ EOF\n \ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/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@@ -4329,7 +4329,7 @@ EOF\n \ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" .\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@@ -4339,7 +4339,7 @@ EOF\n \ttest_repo 31/sub/sub ../../.git \"$TRASH_DIRECTORY/31\"\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@@ -4349,7 +4349,7 @@ EOF\n \ttest_repo 31/sub/sub ../../.git ../..\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@@ -4359,7 +4359,7 @@ EOF\n \ttest_repo 31/sub \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/31\"\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@@ -4369,7 +4369,7 @@ EOF\n \ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" ../..\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@@ -4379,7 +4379,7 @@ EOF\n \ttest_repo 31 .git \"$TRASH_DIRECTORY/31/wt\"\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@@ -4389,7 +4389,7 @@ EOF\n \ttest_repo 31 .git wt\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@@ -4399,7 +4399,7 @@ EOF\n \ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" wt\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@@ -4409,7 +4409,7 @@ EOF\n \ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/31/wt\"\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@@ -4419,7 +4419,7 @@ EOF\n \ttest_repo 31/sub/sub ../../.git \"$TRASH_DIRECTORY/31/wt\"\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@@ -4429,7 +4429,7 @@ EOF\n \ttest_repo 31/sub/sub ../../.git ../../wt\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@@ -4439,7 +4439,7 @@ EOF\n \ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" ../../wt\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@@ -4449,7 +4449,7 @@ EOF\n \ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY/31/wt\"\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@@ -4459,7 +4459,7 @@ EOF\n \ttest_repo 31 .git \"$TRASH_DIRECTORY\"\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@@ -4469,7 +4469,7 @@ EOF\n \ttest_repo 31 .git ..\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@@ -4479,7 +4479,7 @@ EOF\n \ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" ..\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@@ -4489,7 +4489,7 @@ EOF\n \ttest_repo 31 \"$TRASH_DIRECTORY/31/.git\" \"$TRASH_DIRECTORY\"\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@@ -4499,7 +4499,7 @@ EOF\n \ttest_repo 31/sub/sub ../../.git \"$TRASH_DIRECTORY\"\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@@ -4509,7 +4509,7 @@ EOF\n \ttest_repo 31/sub/sub ../../.git ../../..\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@@ -4519,7 +4519,7 @@ EOF\n \ttest_repo 31/sub/sub \"$TRASH_DIRECTORY/31/.git\" ../../../\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.316.gda8b3\n"},{"id":"156674","messageId":"1290785563-15339-45-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 44/47] Remove all logic from get_git_work_tree()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:40Z","receivedAt":"2010-11-26T15:32:40Z","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>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/init-db.c |   14 +++++++++++---\n cache.h           |    1 -\n environment.c     |   32 ++++++++------------------------\n 3 files changed, 19 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 d811049..149c132 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -137,36 +137,20 @@ 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\tnew_work_tree = make_absolute_path(new_work_tree);\n+\t\tif (strcmp(new_work_tree, work_tree))\n+\t\t\tdie(\"internal error: work tree has already been set\\n\"\n+\t\t\t    \"Current worktree: %s\\nNew worktree: %s\",\n+\t\t\t    work_tree, new_work_tree);\n+\t\treturn;\n+\t}\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.316.gda8b3\n"},{"id":"156672","messageId":"1290785563-15339-46-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 45/47] t0001: test git init when run via an alias","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:41Z","receivedAt":"2010-11-26T15:32:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"From: Jonathan Nieder <jrnieder@gmail.com>\n\nAdd some tests to document the correct behavior of (possibly aliased)\ninit when run within and outside a git directory.\n\nIf I set up a simple git alias “quietinit = init --quiet”, usually it\nwill work just like ‘git init --quiet’.\n\nThere are some differences, unfortunately, since in the process of\nchecking for aliases, git has to look for a .git/config file.  If ‘git\nquietinit’ is run from a subdirectory of an existing git repository,\nthat repository’s configuration will affect the configuration of the\nnew repository.  In particular, the new repository can inherit\nbogus values for core.bare and core.worktree.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t0001-init.sh |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 56 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t0001-init.sh b/t/t0001-init.sh\nindex 7fe8883..28c1858 100755\n--- a/t/t0001-init.sh\n+++ b/t/t0001-init.sh\n@@ -33,6 +33,62 @@ test_expect_success 'plain' '\n \tcheck_config plain/.git false unset\n '\n \n+test_expect_success 'plain nested in bare' '\n+\t(\n+\t\tunset GIT_DIR GIT_WORK_TREE &&\n+\t\tgit init --bare bare-ancestor.git &&\n+\t\tcd bare-ancestor.git &&\n+\t\tmkdir plain-nested &&\n+\t\tcd plain-nested &&\n+\t\tgit init\n+\t) &&\n+\tcheck_config bare-ancestor.git/plain-nested/.git false unset\n+'\n+\n+test_expect_success 'plain through aliased command, outside any git repo' '\n+\t(\n+\t\tunset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&\n+\t\tHOME=$(pwd)/alias-config &&\n+\t\texport HOME &&\n+\t\tmkdir alias-config &&\n+\t\techo \"[alias] aliasedinit = init\" >alias-config/.gitconfig &&\n+\n+\t\tGIT_CEILING_DIRECTORIES=$(pwd) &&\n+\t\texport GIT_CEILING_DIRECTORIES &&\n+\n+\t\tmkdir plain-aliased &&\n+\t\tcd plain-aliased &&\n+\t\tgit aliasedinit\n+\t) &&\n+\tcheck_config plain-aliased/.git false unset\n+'\n+\n+test_expect_failure 'plain nested through aliased command' '\n+\t(\n+\t\tunset GIT_DIR GIT_WORK_TREE &&\n+\t\tgit init plain-ancestor-aliased &&\n+\t\tcd plain-ancestor-aliased &&\n+\t\techo \"[alias] aliasedinit = init\" >>.git/config &&\n+\t\tmkdir plain-nested &&\n+\t\tcd plain-nested &&\n+\t\tgit aliasedinit\n+\t) &&\n+\tcheck_config plain-ancestor-aliased/plain-nested/.git false unset\n+'\n+\n+test_expect_failure 'plain nested in bare through aliased command' '\n+\t(\n+\t\tunset GIT_DIR GIT_WORK_TREE &&\n+\t\tgit init --bare bare-ancestor-aliased.git &&\n+\t\tcd bare-ancestor-aliased.git &&\n+\t\techo \"[alias] aliasedinit = init\" >>config &&\n+\t\tmkdir plain-nested &&\n+\t\tcd plain-nested &&\n+\t\tgit aliasedinit\n+\t) &&\n+\tcheck_config bare-ancestor-aliased.git/plain-nested/.git false unset\n+'\n+\n test_expect_success 'plain with GIT_WORK_TREE' '\n \tif (\n \t\tunset GIT_DIR\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156669","messageId":"1290785563-15339-47-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 46/47] Revert \"Documentation: always respect core.worktree if set\"","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:42Z","receivedAt":"2010-11-26T15:32:42Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This reverts commit f5e025a9d5b35e24768475f6890b836ce0d5ed15.\n\nThe commit reflected what the code did. But the code did that because\nit had bugs.\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 Documentation/config.txt |   23 ++++++++---------------\n 1 files changed, 8 insertions(+), 15 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 538ebb5..e29b174 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -317,24 +317,17 @@ false), while all other repositories are assumed to be bare (bare\n = true).\n \n core.worktree::\n-\tSet the path to the root of the work tree.\n+\tSet the path to the working tree.  The value will not be\n+\tused in combination with repositories found automatically in\n+\ta .git directory (i.e. $GIT_DIR is not set).\n \tThis can be overridden by the GIT_WORK_TREE environment\n \tvariable and the '--work-tree' command line option. It can be\n-\tan absolute path or a relative path to the .git directory,\n-\teither specified by --git-dir or GIT_DIR, or automatically\n-\tdiscovered.\n-\tIf --git-dir or GIT_DIR are specified but none of\n+\ta absolute path or relative path to the directory specified by\n+\t--git-dir or GIT_DIR.\n+\tNote: If --git-dir or GIT_DIR are specified but none of\n \t--work-tree, GIT_WORK_TREE and core.worktree is specified,\n-\tthe current working directory is regarded as the root of the\n-\twork tree.\n-+\n-Note that this variable is honored even when set in a configuration\n-file in a \".git\" subdirectory of a directory, and its value differs\n-from the latter directory (e.g. \"/path/to/.git/config\" has\n-core.worktree set to \"/different/path\"), which is most likely a\n-misconfiguration.  Running git commands in \"/path/to\" directory will\n-still use \"/different/path\" as the root of the work tree and can cause\n-great confusion to the users.\n+\tthe current working directory is regarded as the top directory\n+\tof your working tree.\n \n core.logAllRefUpdates::\n \tEnable the reflog. Updates to a ref <ref> is logged to the file\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156670","messageId":"1290785563-15339-48-git-send-email-pclouds@gmail.com","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 47/47] git.txt: correct where --work-tree path is relative to","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-26T15:32:43Z","receivedAt":"2010-11-26T15:32:43Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git.txt |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 0c897df..7433601 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -285,7 +285,7 @@ help ...`.\n \tThis can also be controlled by setting the GIT_WORK_TREE\n \tenvironment variable and the core.worktree configuration\n \tvariable. It can be an absolute path or relative path to\n-\tthe directory specified by --git-dir or GIT_DIR.\n+\tcurrent working directory.\n \tNote: If --git-dir or GIT_DIR are specified but none of\n \t--work-tree, GIT_WORK_TREE and core.worktree is specified,\n \tthe current working directory is regarded as the top directory\n-- \n1.7.3.2.316.gda8b3\n"},{"id":"156843","messageId":"7v1v6324zu.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"1290785563-15339-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 00/47] nd/setup updates on pu","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-11-29T21:29:25Z","receivedAt":"2010-11-29T21:29:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> Only tests are updated to eliminate bashisms. Tested on busybox ash.\n\nThanks for your attention to detail; will replace.\n"},{"id":"158470","messageId":"7vvd2m605f.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"1290785563-15339-37-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 36/47] rev-parse: prints --git-dir relative to user's cwd","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-22T01:56:12Z","receivedAt":"2010-12-22T01:56:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> git_dir variable in environment.c is relative to git's cwd, not user's\n> cwd. Convert the relative path (actualy by making it absolute path)\n> before printing out.\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  builtin/rev-parse.c |    6 +++++-\n>  1 files changed, 5 insertions(+), 1 deletions(-)\n>\n> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\n> index 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\nI do not quite understand this change.  I can obtain GIT_DIR in a relative\nform without this patch already:\n\n    $ cd t/\n    $ git --git-dir=../.git rev-parse --git-dir HEAD\n    ../.git\n    c7511731675da8b50c0d5243aa04a98c8a5ee316\n\nCould we please have a new test case to demonstrate what is broken without\nthis patch?\n"},{"id":"158471","messageId":"7vpqsu6059.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"1290785563-15339-45-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 44/47] Remove all logic from get_git_work_tree()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-22T01:56:18Z","receivedAt":"2010-12-22T01:56:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> This logic is now only used by cmd_init_db(). setup_* functions do not\n> rely on it any more. Move all the logic to cmd_init_db() and turn\n> get_git_work_tree() into a simple function.\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n> diff --git a/environment.c b/environment.c\n> index d811049..149c132 100644\n> --- a/environment.c\n> +++ b/environment.c\n> @@ -137,36 +137,20 @@ static int git_work_tree_initialized;\n>   */\n> ...\n>  const char *get_git_work_tree(void)\n>  {\n> -\tif (startup_info && !startup_info->setup_explicit) {\n> -...\n> -\t}\n>  \treturn work_tree;\n>  }\n\nWould it be a bug in the new set-up code if this function gets called and\nwork_tree is still NULL?\n\nThere are quite a few callers that call get_git_work_tree() and expect\nthat it will always return a non NULL pointer.  Perhaps we would want an\nassertion here?\n"},{"id":"158474","messageId":"AANLkTi=DPrQirbp3mOfQkU3Dx_eYmp1inVYx-GqqD9V5@mail.gmail.com","threadId":"25845","inReplyTo":"7vvd2m605f.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 36/47] rev-parse: prints --git-dir relative to user's cwd","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-12-22T07:05:28Z","receivedAt":"2010-12-22T07:05:28Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2010/12/22 Junio C Hamano <gitster@pobox.com>:\n> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n>\n>> git_dir variable in environment.c is relative to git's cwd, not user's\n>> cwd. Convert the relative path (actualy by making it absolute path)\n>> before printing out.\n>>\n>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n>> ---\n>>  builtin/rev-parse.c |    6 +++++-\n>>  1 files changed, 5 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\n>> index 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>>                               static char cwd[PATH_MAX];\n>>                               int len;\n>>                               if (gitdir) {\n>> -                                     puts(gitdir);\n>> +                                     if (is_absolute_path(gitdir) || !prefix) {\n>> +                                             puts(gitdir);\n>> +                                             continue;\n>> +                                     }\n>> +                                     puts(make_absolute_path(gitdir));\n>>                                       continue;\n>>                               }\n>>                               if (!prefix) {\n>\n> I do not quite understand this change.  I can obtain GIT_DIR in a relative\n> form without this patch already:\n>\n>    $ cd t/\n>    $ git --git-dir=../.git rev-parse --git-dir HEAD\n>    ../.git\n>    c7511731675da8b50c0d5243aa04a98c8a5ee316\n>\n> Could we please have a new test case to demonstrate what is broken without\n> this patch?\n>\n\nUm.. GIT_DIR can be changed by set_git_dir() inside\nsetup_directory_gently() and be relative to git's internal (movable)\ncwd. The current code won't fall to that code path because GIT_DIR is\nmade absolute in most cases. A few cases we keep GIT_DIR relative,\nwe're sure cwd is not moved, or $GIT_DIR is not set and handled by\nrev-parse code.\n\nI reverted the patch and ran \"make test\". Passed. When an attempt to\nmake $GIT_DIR relative to worktree as much as possible happens, this\nmay be needed. But for now, I'm OK if you take this patch out. I'll\nput it back on when I make such an attempt.\n-- \nDuy\n"},{"id":"158475","messageId":"AANLkTikOOaKSf333UzawEgAf_=t-WBrWLu7tmiOrqO8V@mail.gmail.com","threadId":"25845","inReplyTo":"7vpqsu6059.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 44/47] Remove all logic from get_git_work_tree()","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-12-22T07:22:30Z","receivedAt":"2010-12-22T07:22:30Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2010/12/22 Junio C Hamano <gitster@pobox.com>:\n>>  const char *get_git_work_tree(void)\n>>  {\n>> -     if (startup_info && !startup_info->setup_explicit) {\n>> -...\n>> -     }\n>>       return work_tree;\n>>  }\n>\n> Would it be a bug in the new set-up code if this function gets called and\n> work_tree is still NULL?\n>\n> There are quite a few callers that call get_git_work_tree() and expect\n> that it will always return a non NULL pointer.  Perhaps we would want an\n> assertion here?\n>\n\nWhile the assertion sounds good, it does not work well. The old\nfunction can return NULL in bare repos. is_bare_repository() and\nis_inside_work_tree() expect NULL from get_git_work_tree() sometimes.\n\nI'll see if I can move is_inside_work_tree() over environment.c (so\nthat both callers can access work_tree var directly) and have a clean\n\"make test\". It does not look feasible though because of the static\nvariable inside_work_tree in setup.c.\n-- \nDuy\n"},{"id":"158490","messageId":"7vd3ot6dlx.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"AANLkTikOOaKSf333UzawEgAf_=t-WBrWLu7tmiOrqO8V@mail.gmail.com","subject":"Re: [PATCH 44/47] Remove all logic from get_git_work_tree()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-22T15:17:46Z","receivedAt":"2010-12-22T15:17:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> 2010/12/22 Junio C Hamano <gitster@pobox.com>:\n>>>  const char *get_git_work_tree(void)\n>>>  {\n>>> -     if (startup_info && !startup_info->setup_explicit) {\n>>> -...\n>>> -     }\n>>>       return work_tree;\n>>>  }\n>>\n>> Would it be a bug in the new set-up code if this function gets called and\n>> work_tree is still NULL?\n>>\n>> There are quite a few callers that call get_git_work_tree() and expect\n>> that it will always return a non NULL pointer.  Perhaps we would want an\n>> assertion here?\n>>\n>\n> While the assertion sounds good, it does not work well. The old\n> function can return NULL in bare repos. is_bare_repository() and\n> is_inside_work_tree() expect NULL from get_git_work_tree() sometimes.\n\nOk, don't bother changing anything in that case---it won't help us much.\n"},{"id":"159573","messageId":"20110118074400.GA4185@burratino","threadId":"25845","inReplyTo":"1290785563-15339-40-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH 39/47] setup: limit get_git_work_tree()'s to explicit setup case only","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-18T07:44:00Z","receivedAt":"2011-01-18T07:44:00Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyễn Thái Ngọc Duy wrote:\n\n> get_git_work_tree() takes input as core.worktree, core.bare,\n> GIT_WORK_TREE and decides correct worktree setting.\n>\n> Unfortunately it does not do its job well. core.worktree and\n> GIT_WORK_TREE should only be taken into account, if GIT_DIR is set\n\nAs advertised, before this change\n\n\tGIT_WORK_TREE=$path git add .\n\npaid attention to $GIT_WORK_TREE (and set GIT_DIR=.git), and\nafterwards the GIT_WORK_TREE setting has been ignored when GIT_DIR is\nnot set explicitly.\n\nUnfortunately, that breaks some scripts.  Example: using the \"git\nimport-dsc\" utility from git-buildpackage to import a source package:\n\n\tdebsnap libwpd 0.7.2-1\n\tgit clone git://libwpd.git.sourceforge.net/gitroot/libwpd/libwpd\n\tgit tag upstream/0.7.2 RELEASE-0-7-2^{commit}\n\tgit reset --keep origin/master\n\tgit import-dsc ../source-libwpd/libwpd_0.7.2-1.dsc \n\techo $?\n\tgit show --raw\n\techo done.\n\nWith git v1.7.4-rc2:\n\n\tHEAD is now at d183cc6 Imported Debian patch 0.7.2-1\n\tgbp:info: Everything imported under 'libwpd'\n\t0\n\tcommit d183cc6c4b8dcaf22b1b0875aad0655846ed3b1b\n\tAuthor: Masayuki Hatta (mhatta) <mhatta@debian.org>\n\tDate:   Tue Aug 10 00:37:47 2004 +0900\n\n\t    Imported Debian patch 0.7.2-1\n\n\tdone\n\nversus v1.7.3.2:\n\n\tHEAD is now at 735a8f2 Imported Debian patch 0.7.2-1\n\tgbp:info: Everything imported under 'libwpd'\n\t0\n\tcommit 735a8f21ea817417ecc035817f777bd2943d4efc\n\tAuthor: Masayuki Hatta (mhatta) <mhatta@debian.org>\n\tDate:   Tue Aug 10 00:37:47 2004 +0900\n\n\t    Imported Debian patch 0.7.2-1\n\n\t:100644 000000 038cd09... 0000000... D  .gitignore\n\t:000000 100644 0000000... 0189791... A  CHANGES\n\t[...]\n\ngit-buildpackage uses the equivalent of\n\n\tGIT_INDEX_FILE=$(pwd)/.git/gbp_index \\\n\tGIT_WORK_TREE=$unpack_dir \\\n\tgit add -f .\n\nwhen creating the commit, so with v1.7.4-rc0 and later it is taking\nits content from the cwd, producing an incorrect result without\ncomplaint.\n\nHow about something like this patch?  It only concerns the\nGIT_WORK_TREE variable and --work-tree command line option; the\nsemantics of core.worktree are unaffected.\n\n(Sorry, no real patch yet.  Updating the test to reflect the change is\na pain in the neck.)\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\ndiff --git a/setup.c b/setup.c\nindex 3d73269..28b2fef 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -419,6 +419,11 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \t\treturn NULL;\n \t}\n \n+\tif (getenv(GIT_WORK_TREE_ENVIRONMENT)) {\n+\t\twarning(\"GIT_WORK_TREE without explicit GIT_DIR is deprecated\");\n+\t\treturn setup_explicit_git_dir(gitdir, cwd, offset, nongit_ok);\n+\t}\n+\n \t/* #0, #1, #5, #8, #9, #12, #13 */\n \tset_git_work_tree(\".\");\n \tif (strcmp(gitdir, DEFAULT_GIT_DIR_ENVIRONMENT))\n@@ -443,6 +448,11 @@ static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongi\n \tif (check_repository_format_gently(\".\", nongit_ok))\n \t\treturn NULL;\n \n+\tif (getenv(GIT_WORK_TREE_ENVIRONMENT)) {\n+\t\twarning(\"GIT_WORK_TREE without explicit GIT_DIR is deprecated\");\n+\t\treturn setup_explicit_git_dir(\".\", cwd, offset, nongit_ok);\n+\t}\n+\n \tinside_git_dir = 1;\n \tinside_work_tree = 0;\n \tif (offset != len) {\n"},{"id":"159579","messageId":"AANLkTinTSiDhfcEzYVji0xD44BY0HPpzLYuZoNgMPdkt@mail.gmail.com","threadId":"25845","inReplyTo":"20110118074400.GA4185@burratino","subject":"Re: [PATCH 39/47] setup: limit get_git_work_tree()'s to explicit setup case only","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-01-18T13:59:37Z","receivedAt":"2011-01-18T13:59:37Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/1/18 Jonathan Nieder <jrnieder@gmail.com>:\n> How about something like this patch?  It only concerns the\n> GIT_WORK_TREE variable and --work-tree command line option; the\n> semantics of core.worktree are unaffected.\n\nPerhaps only activate your code if $GIT_WORK_TREE is absolute path?\nThings may go wild if $GIT_WORK_TREE is relative. We can die() if\nGIT_WORK_TREE is set but not used. Annoying, but better than leave the\nerrors unseen.\n\n> (Sorry, no real patch yet.  Updating the test to reflect the change is\n> a pain in the neck.)\n\nYeah, I count on it to (over-)catch every mistakes in setup code :D\n-- \nDuy\n"},{"id":"159592","messageId":"7v1v4aknij.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"20110118074400.GA4185@burratino","subject":"Re: [PATCH 39/47] setup: limit get_git_work_tree()'s to explicit setup case only","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-18T19:41:40Z","receivedAt":"2011-01-18T19:41:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> diff --git a/setup.c b/setup.c\n> index 3d73269..28b2fef 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -419,6 +419,11 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n>  \t\treturn NULL;\n>  \t}\n>  \n> +\tif (getenv(GIT_WORK_TREE_ENVIRONMENT)) {\n> +\t\twarning(\"GIT_WORK_TREE without explicit GIT_DIR is deprecated\");\n> +\t\treturn setup_explicit_git_dir(gitdir, cwd, offset, nongit_ok);\n> +\t}\n> +\n\nMy knee-jerk reaction is that calling this \"deprecated\" is probably\nconfusing. git merely failed to notice misconfiguration so far and went\nahead to produce a random result when GIT_DIR is not set (hence the usual\nrule is in effect to find out where the .git directory is, starting from\nthe assumption that you _are_ somewhere _inside_ the work tree, _and_ the\nroot of the work tree _is_ where that .git directory is found in) and at\nthe same time GIT_WORK_TREE is pointing at a random other location.\n\nUnless that location happens to match the parent directory of the\ndiscovered .git, this invalidates the assumption of the whole discovery\nlogic (iow, how you found .git to begin with). In other words, it is my\nunderstanding that setting only GIT_WORK_TREE without setting GIT_DIR\nwasn't meant to be supported at all, because there is no sane logic to\nspecify a consistent behaviour in such a case.\n\nIf \"we first run discovery as if you were somewhere in your work tree to\nfind .git directory, but you are allowed to say that your working tree is\nelsewhere, possibly completely unrelated to the tree hierarchy used to\nfind .git directory to begin with; we could accomodate these conflicting\nwishes because hopefully the necessary set-up happens before we actually\nneed to touch anything in the work tree\" were a sane specification, this\npatch may start making sense. Not breaking existing scripts that rely on\nthe behaviour is a nice bonus. The \"hopefully\" part makes me worried\nenough to keep me from saying that semantics is sane without thinking\nthough.\n\nI notice that git(1) manual page discusses --work-tree=<path> (and\nGIT_WORK_TREE) to a reasonable level of details (the most importantly, the\nrule to determine where the root of the working tree is when nothing is\nspecified is given), but the corresponding description on --git-dir=<path>\n(and GIT_DIR) is too sketchy to tell how the discovery works when nothing\nis given. Perhaps that part needs to address what the semantics should be?\n\n>  \t/* #0, #1, #5, #8, #9, #12, #13 */\n>  \tset_git_work_tree(\".\");\n>  \tif (strcmp(gitdir, DEFAULT_GIT_DIR_ENVIRONMENT))\n> @@ -443,6 +448,11 @@ static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongi\n>  \tif (check_repository_format_gently(\".\", nongit_ok))\n>  \t\treturn NULL;\n>  \n> +\tif (getenv(GIT_WORK_TREE_ENVIRONMENT)) {\n> +\t\twarning(\"GIT_WORK_TREE without explicit GIT_DIR is deprecated\");\n> +\t\treturn setup_explicit_git_dir(\".\", cwd, offset, nongit_ok);\n> +\t}\n>  \tinside_git_dir = 1;\n>  \tinside_work_tree = 0;\n\nThis is for people who do \"cd .git && GIT_WORK_TREE=.. git cmd\". I have to\nwonder what happens to the pathspec given to the cmd---you are clearly\noutside of your working tree.\n\nA tangent.\n\nDo we make sure that whatever GIT_WORK_TREE we end up with using is an\nancestor directory of the $CWD when we require us to be inside the working\ntree? I think we should, as I don't think of a sane use case otherwise\n(unless you call \"cd ../neigh; GIT_WORK_TREE=../work git diff ../work/foo\"\na sane way to futz with the file \"foo\" in the working tree \"work\" from a\ndirectory \"neigh\" that is unrelated to the repository).\n"},{"id":"159616","messageId":"AANLkTi=bm6KO24XTMA+LM+xnszgFHJiV0inXZ-RJwwd-@mail.gmail.com","threadId":"25845","inReplyTo":"7v1v4aknij.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 39/47] setup: limit get_git_work_tree()'s to explicit setup case only","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-01-19T01:58:46Z","receivedAt":"2011-01-19T01:58:46Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/1/19 Junio C Hamano <gitster@pobox.com>:\n> This is for people who do \"cd .git && GIT_WORK_TREE=.. git cmd\". I have to\n> wonder what happens to the pathspec given to the cmd---you are clearly\n> outside of your working tree.\n\npathspecs are relative to worktree's root because prefix is NULL in\nthis case. Not very intuitive. And pathspecs that are supposed to take\nfiles relative to user's cwd simply fail.\n\n> Do we make sure that whatever GIT_WORK_TREE we end up with using is an\n> ancestor directory of the $CWD when we require us to be inside the working\n> tree?\n\nWe don't for most of commands (i.e. blindly chdir(worktree) in\nsetup_work_tree()). Only two commands (ls-files and rev-parse) seem to\ndo that.\n\n> I think we should, as I don't think of a sane use case otherwise\n> (unless you call \"cd ../neigh; GIT_WORK_TREE=../work git diff ../work/foo\"\n> a sane way to futz with the file \"foo\" in the working tree \"work\" from a\n> directory \"neigh\" that is unrelated to the repository).\n\nBut we don't strictly need that for whole tree operations. If\npathspecs are not given, wherever worktree is compared to cwd does not\nmatter much. The tricky thing is, when setup code does not know in\nadvance whether pathspecs are given. Perhaps something (untested) like\nthis for a start? Some commands like commit can also have\nWHOLE_WORK_TREE, but it needs to check for is_inside_work_tree() by\nitself it pathspec is given.\n\ndiff --git a/git.c b/git.c\nindex 68334f6..28abbdd 100644\n--- a/git.c\n+++ b/git.c\n@@ -248,6 +248,10 @@ const char git_version_string[] = GIT_VERSION;\n  * RUN_SETUP for reading from the configuration file.\n  */\n #define NEED_WORK_TREE\t\t(1<<3)\n+/*\n+ * This command only works on work tree as a whole\n+ */\n+#define WHOLE_WORK_TREE         (1<<4)\n\n struct cmd_struct {\n \tconst char *cmd;\n@@ -283,7 +287,7 @@ static int run_builtin(struct cmd_struct *p, int\nargc, const char **argv)\n \tcommit_pager_choice();\n\n \tif (!help && p->option & NEED_WORK_TREE)\n-\t\tsetup_work_tree();\n+\t\tsetup_work_tree(p->option & WHOLE_WORK_TREE);\n\n \ttrace_argv_printf(argv, \"trace: built-in: git\");\n\n@@ -328,7 +332,7 @@ static void handle_internal_command(int argc,\nconst char **argv)\n \t\t{ \"check-ref-format\", cmd_check_ref_format },\n \t\t{ \"check-attr\", cmd_check_attr, RUN_SETUP },\n \t\t{ \"cherry\", cmd_cherry, RUN_SETUP },\n-\t\t{ \"cherry-pick\", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE },\n+\t\t{ \"cherry-pick\", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE |\nWHOLE_WORK_TREE },\n \t\t{ \"clone\", cmd_clone },\n \t\t{ \"clean\", cmd_clean, RUN_SETUP | NEED_WORK_TREE },\n \t\t{ \"commit\", cmd_commit, RUN_SETUP | NEED_WORK_TREE },\n@@ -362,7 +366,7 @@ static void handle_internal_command(int argc,\nconst char **argv)\n \t\t{ \"ls-remote\", cmd_ls_remote, RUN_SETUP_GENTLY },\n \t\t{ \"mailinfo\", cmd_mailinfo },\n \t\t{ \"mailsplit\", cmd_mailsplit },\n-\t\t{ \"merge\", cmd_merge, RUN_SETUP | NEED_WORK_TREE },\n+\t\t{ \"merge\", cmd_merge, RUN_SETUP | NEED_WORK_TREE | WHOLE_WORK_TREE },\n \t\t{ \"merge-base\", cmd_merge_base, RUN_SETUP },\n \t\t{ \"merge-file\", cmd_merge_file, RUN_SETUP_GENTLY },\n \t\t{ \"merge-index\", cmd_merge_index, RUN_SETUP },\n@@ -397,13 +401,13 @@ static void handle_internal_command(int argc,\nconst char **argv)\n \t\t{ \"reset\", cmd_reset, RUN_SETUP },\n \t\t{ \"rev-list\", cmd_rev_list, RUN_SETUP },\n \t\t{ \"rev-parse\", cmd_rev_parse },\n-\t\t{ \"revert\", cmd_revert, RUN_SETUP | NEED_WORK_TREE },\n+\t\t{ \"revert\", cmd_revert, RUN_SETUP | NEED_WORK_TREE | WHOLE_WORK_TREE },\n \t\t{ \"rm\", cmd_rm, RUN_SETUP },\n \t\t{ \"send-pack\", cmd_send_pack, RUN_SETUP },\n \t\t{ \"shortlog\", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },\n \t\t{ \"show-branch\", cmd_show_branch, RUN_SETUP },\n \t\t{ \"show\", cmd_show, RUN_SETUP },\n-\t\t{ \"status\", cmd_status, RUN_SETUP | NEED_WORK_TREE },\n+\t\t{ \"status\", cmd_status, RUN_SETUP | NEED_WORK_TREE | WHOLE_WORK_TREE },\n \t\t{ \"stripspace\", cmd_stripspace },\n \t\t{ \"symbolic-ref\", cmd_symbolic_ref, RUN_SETUP },\n \t\t{ \"tag\", cmd_tag, RUN_SETUP },\ndiff --git a/setup.c b/setup.c\nindex 3d73269..c14e55c 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -208,7 +208,7 @@ int is_inside_work_tree(void)\n \treturn inside_work_tree;\n }\n\n-void setup_work_tree(void)\n+void setup_work_tree(int gently)\n {\n \tconst char *work_tree, *git_dir;\n \tstatic int initialized = 0;\n@@ -219,7 +219,11 @@ void setup_work_tree(void)\n \tgit_dir = get_git_dir();\n \tif (!is_absolute_path(git_dir))\n \t\tgit_dir = make_absolute_path(git_dir);\n-\tif (!work_tree || chdir(work_tree))\n+\tif (work_tree && (gently || is_inside_work_tree()))\n+\t\t; \t\t/* Good */\n+\telse\n+\t\tdie(\"This operation must be run in a work tree\");\n+\tif (chdir(work_tree))\n \t\tdie(\"This operation must be run in a work tree\");\n\n \t/*\n\n-- \nDuy\n"},{"id":"159642","messageId":"20110119123732.GA23222@burratino","threadId":"25845","inReplyTo":"7v1v4aknij.fsf@alter.siamese.dyndns.org","subject":"[PATCH/RFC 0/3] setup: stop ignoring GIT_WORK_TREE (when GIT_DIR is unset)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T12:37:32Z","receivedAt":"2011-01-19T12:37:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> +++ b/setup.c\n>> @@ -419,6 +419,11 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n>>  \t\treturn NULL;\n>>  \t}\n>>  \n>> +\tif (getenv(GIT_WORK_TREE_ENVIRONMENT)) {\n>> +\t\twarning(\"GIT_WORK_TREE without explicit GIT_DIR is deprecated\");\n>> +\t\treturn setup_explicit_git_dir(gitdir, cwd, offset, nongit_ok);\n>> +\t}\n>> +\n>\n> My knee-jerk reaction is that calling this \"deprecated\" is probably\n> confusing. git merely failed to notice misconfiguration\n\nAfter staring at test results, I agree.  The rule, before nd/setup,\nseems to be something like this:\n\n - if GIT_DIR is set, you're safe\n - if GIT_DIR is unset and .git is in the current directory,\n   GIT_WORK_TREE will work by accident\n - otherwise, git errors out.\n\nThe patch below should be more robust.  It prints a warning:\n\n\twarning: pretending GIT_DIR was supplied alongside GIT_WORK_TREE\n\nAs the night winds on I am less sure that that warning is a good idea.\nThe .git discovery behavior seems relatively safe.  What is more\nworrisome for the future of the use of GIT_WORK_TREE independent of\ncwd is the interaction with pathspecs.\n\nJonathan Nieder (3):\n  tests: cosmetic improvements to the repo-setup test\n  tests: make the setup tests briefer\n  setup: stop ignoring GIT_WORK_TREE and core.worktree\n\n setup.c               |   27 +-\n t/t1510-repo-setup.sh | 5166 +++++++------------------------------------------\n 2 files changed, 729 insertions(+), 4464 deletions(-)\n"},{"id":"159643","messageId":"20110119123822.GB23222@burratino","threadId":"25845","inReplyTo":"20110119123732.GA23222@burratino","subject":"[PATCH 1/3] tests: cosmetic improvements to the repo-setup test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T12:38:22Z","receivedAt":"2011-01-19T12:38:22Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Give an overview in \"sh t1510-repo-setup.sh --help\" output.\nWaste some vertical and horizontal space for clearer code.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t1510-repo-setup.sh |   94 ++++++++++++++++++++++++++-----------------------\n 1 files changed, 50 insertions(+), 44 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex e9c451c..f42f206 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -1,53 +1,59 @@\n #!/bin/sh\n \n-test_description='Tests of cwd/prefix/worktree/gitdir setup in all cases'\n+test_description=\"Tests of cwd/prefix/worktree/gitdir setup in all cases\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 . ./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+test_repo () {\n \t(\n-\tcd \"$1\" &&\n-\tif test -n \"$2\"; then GIT_DIR=\"$2\" && export GIT_DIR; fi &&\n-\tif test -n \"$3\"; then GIT_WORK_TREE=\"$3\" && export GIT_WORK_TREE; fi &&\n-\trm -f trace &&\n-\tGIT_TRACE=\"`pwd`/trace\" git symbolic-ref HEAD >/dev/null &&\n-\tgrep '^setup: ' trace >result &&\n-\ttest_cmp expected result\n+\t\tcd \"$1\" &&\n+\t\tif test -n \"$2\"\n+\t\tthen\n+\t\t\tGIT_DIR=\"$2\" &&\n+\t\t\texport GIT_DIR\n+\t\tfi &&\n+\t\tif test -n \"$3\"\n+\t\tthen\n+\t\t\tGIT_WORK_TREE=\"$3\" &&\n+\t\t\texport GIT_WORK_TREE\n+\t\tfi &&\n+\t\trm -f trace &&\n+\t\tGIT_TRACE=\"$(pwd)/trace\" git symbolic-ref HEAD >/dev/null &&\n+\t\tgrep '^setup: ' trace >result &&\n+\t\ttest_cmp expected result\n \t)\n }\n \n-- \n1.7.4.rc2\n"},{"id":"159644","messageId":"20110119124230.GD23222@burratino","threadId":"25845","inReplyTo":"20110119123732.GA23222@burratino","subject":"[PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T12:42:30Z","receivedAt":"2011-01-19T12:42:30Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"In the usual case, git commands are run from within a git worktree.\nThe toplevel directory and associated .git dir are found by chdir-ing\nto .. repeatedly until .git is a valid repository.\n\nThat behavior can be overridden in two ways.\n\n (1) By setting GIT_DIR (through the environment or the --git-dir\n     command line option), one can keep the repository somewhere\n     unrelated to the worktree.\n\n (2) By setting GIT_WORK_TREE (through the environment, --work-tree\n     command line option, or [core] worktree configuration) in\n     addition to GIT_DIR, one can use a directory other than the cwd\n     as toplevel of the worktree.\n\nUnfortunately the existence of GIT_WORK_TREE makes it tempting to\nuse without setting GIT_DIR.  Until v1.7.4-rc0~4^2~9 (setup: limit\nget_git_work_tree()'s to explicit setup case only, 2010-11-26), that\nonly happened to work, sometimes:\n\n - if .git is in the current directory, it might work;\n - otherwise, git would fail to discover the .git directory.\n\nOuch.  It would be better to forbid setting a work tree without git\ndir entirely, except that due to this accidental support some scripts\n(e.g., git-buildpackage, gitolite) learned to use rely on it over the\nyears.\n\nInstead (1) first run discovery as though within a worktree trying to\nfind the .git dir, and (2) only once discovery is finished, check the\nGIT_WORK_TREE setting to see if the worktree is declared to be\nsomewhere else entirely.\n\nAlso print a warning when GIT_WORK_TREE is set and GIT_DIR not, to\nprevent nonportable scripts relying on this new behavior.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n setup.c               |   27 +++++++-\n t/t1510-repo-setup.sh |  199 ++++++++++++++++++++++++++----------------------\n 2 files changed, 134 insertions(+), 92 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 3d73269..c0f5846 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -411,6 +411,16 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \tif (check_repository_format_gently(gitdir, nongit_ok))\n \t\treturn NULL;\n \n+\t/* Accept --work-tree to support old scripts that played with fire. */\n+\tif (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n+\t\twarning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n+\t\tif (offset != len && !is_absolute_path(gitdir))\n+\t\t\tgitdir = xstrdup(make_absolute_path(gitdir));\n+\t\tif (chdir(cwd))\n+\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\treturn setup_explicit_git_dir(gitdir, cwd, len, nongit_ok);\n+\t}\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@@ -443,6 +453,19 @@ static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongi\n \tif (check_repository_format_gently(\".\", nongit_ok))\n \t\treturn NULL;\n \n+\t/*\n+\t * Accept --work-tree, reluctantly.\n+\t */\n+\tif (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n+\t\tconst char *gitdir;\n+\n+\t\twarning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n+\t\tgitdir = offset == len ? \".\" : xmemdupz(cwd, offset);\n+\t\tif (chdir(cwd))\n+\t\t\tdie_errno(\"Could not come back to cwd\");\n+\t\treturn setup_explicit_git_dir(gitdir, cwd, len, nongit_ok);\n+\t}\n+\n \tinside_git_dir = 1;\n \tinside_work_tree = 0;\n \tif (offset != len) {\n@@ -509,8 +532,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t * validation.\n \t */\n \tgitdirenv = getenv(GIT_DIR_ENVIRONMENT);\n-\tif (gitdirenv)\n+\tif (gitdirenv) {\n+\t\ttrace_printf(\"trace: gitdirenv = %s\\n\", gitdirenv);\n \t\treturn setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);\n+\t}\n \n \tceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);\n \tif (ceil_offset < 0 && has_dos_drive_prefix(cwd))\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 4f8f976..b8a1b02 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -16,8 +16,9 @@ A few rules for repo setup:\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+5. GIT_WORK_TREE/core.worktree is only meant to work if GIT_DIR is set.\n+   Otherwise there is a warning and a best effort is made to follow\n+   historical behavior.\n \n 6. Effective GIT_WORK_TREE overrides core.worktree and core.bare\n \n@@ -224,13 +225,16 @@ try_repo () {\n test_expect_success '#0: nonbare repo, no explicit configuration' '\n \ttry_repo 0 unset unset unset \"\" unset \\\n \t\t.git \"$here/0\" \"$here/0\" \"(null)\" \\\n-\t\t.git \"$here/0\" \"$here/0\" sub/\n+\t\t.git \"$here/0\" \"$here/0\" sub/ 2>messages &&\n+\t! grep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" messages\n '\n \n-test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is ignored' '\n-\ttry_repo 1 non-existent unset unset \"\" unset \\\n-\t\t.git \"$here/1\" \"$here/1\" \"(null)\" \\\n-\t\t.git \"$here/1\" \"$here/1\" sub/\n+test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is reluctantly accepted' '\n+\tmkdir -p wt &&\n+\ttry_repo 1 \"$here\" unset unset \"\" unset \\\n+\t\t\"$here/1/.git\" \"$here\" \"$here\" 1/ \\\n+\t\t\"$here/1/.git\" \"$here\" \"$here\" 1/sub/ 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n test_expect_success '#2: worktree defaults to cwd with explicit GIT_DIR' '\n@@ -251,17 +255,24 @@ test_expect_success '#3: setup' '\n '\n run_wt_tests 3\n \n-test_expect_success '#4: core.worktree without GIT_DIR set is ignored' '\n-\ttry_repo 4 unset unset non-existent \"\" unset \\\n-\t\t.git \"$here/4\" \"$here/4\" \"(null)\" \\\n-\t\t.git \"$here/4\" \"$here/4\" sub/\n+test_expect_success '#4: core.worktree without GIT_DIR set is reluctantly accepted' '\n+\tsetup_repo 4 ../sub \"\" unset &&\n+\tmkdir -p 4/sub sub &&\n+\ttry_case 4 unset unset \\\n+\t\t.git \"$here/4/sub\" \"$here/4\" \"(null)\" \\\n+\t\t\"$here/4/.git\" \"$here/4/sub\" \"$here/4/sub\" \"(null)\" 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n-test_expect_success '#5: core.worktree + GIT_WORK_TREE is still ignored' '\n+test_expect_success '#5: core.worktree + GIT_WORK_TREE is reluctantly accepted' '\n \t# or: you cannot intimidate away the lack of GIT_DIR setting\n-\ttry_repo 5 non-existent-too unset non-existent \"\" unset \\\n-\t\t.git \"$here/5\" \"$here/5\" \"(null)\" \\\n-\t\t.git \"$here/5\" \"$here/5\" sub/\n+\ttry_repo 5 \"$here\" unset \"$here/5\" \"\" unset \\\n+\t\t\"$here/5/.git\" \"$here\" \"$here\" 5/ \\\n+\t\t\"$here/5/.git\" \"$here\" \"$here\" 5/sub/ 2>message &&\n+\ttry_repo 5a .. unset \"$here/5a\" \"\" unset \\\n+\t\t\"$here/5a/.git\" \"$here\" \"$here\" 5a/ \\\n+\t\t\"$here/5a/.git\" \"$here/5a\" \"$here/5a\" sub/ &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n test_expect_success '#6: setting GIT_DIR brings core.worktree to life' '\n@@ -353,10 +364,12 @@ test_expect_success '#8: gitfile, easy case' '\n \t\t\"$here/8.git\" \"$here/8\" \"$here/8\" sub/\n '\n \n-test_expect_success '#9: GIT_WORK_TREE ignored even with gitfile' '\n-\ttry_repo 9 non-existent unset unset gitfile unset \\\n-\t\t\"$here/9.git\" \"$here/9\" \"$here/9\" \"(null)\" \\\n-\t\t\"$here/9.git\" \"$here/9\" \"$here/9\" sub/\n+test_expect_success '#9: GIT_WORK_TREE reluctantly accepted with gitfile' '\n+\tmkdir -p 9/wt &&\n+\ttry_repo 9 wt unset unset gitfile unset \\\n+\t\t\"$here/9.git\" \"$here/9/wt\" \"$here/9\" \"(null)\" \\\n+\t\t\"$here/9.git\" \"$here/9/sub/wt\" \"$here/9/sub\" \"(null)\" 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n test_expect_success '#10: GIT_DIR can point to gitfile' '\n@@ -378,17 +391,19 @@ test_expect_success '#11: setup' '\n '\n run_wt_tests 11 gitfile\n \n-test_expect_success '#12: core.worktree with gitfile is still ignored' '\n-\ttry_repo 12 unset unset non-existent gitfile unset \\\n+test_expect_success '#12: core.worktree with gitfile is reluctantly accepted' '\n+\ttry_repo 12 unset unset \"$here/12\" gitfile unset \\\n \t\t\"$here/12.git\" \"$here/12\" \"$here/12\" \"(null)\" \\\n-\t\t\"$here/12.git\" \"$here/12\" \"$here/12\" sub/\n+\t\t\"$here/12.git\" \"$here/12\" \"$here/12\" sub/ 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n-test_expect_success '#13: core.worktree+GIT_WORK_TREE ignored (with gitfile)' '\n+test_expect_success '#13: core.worktree+GIT_WORK_TREE relucantly accepted (with gitfile)' '\n \t# or: you cannot intimidate away the lack of GIT_DIR setting\n \ttry_repo 13 non-existent-too unset non-existent gitfile unset \\\n-\t\t\"$here/13.git\" \"$here/13\" \"$here/13\" \"(null)\" \\\n-\t\t\"$here/13.git\" \"$here/13\" \"$here/13\" sub/\n+\t\t\"$here/13.git\" \"$here/13/non-existent-too\" \"$here/13\" \"(null)\" \\\n+\t\t\"$here/13.git\" \"$here/13/sub/non-existent-too\" \"$here/13/sub\" \"(null)\" 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n # case #14.\n@@ -499,30 +514,32 @@ test_expect_success '#16c: bare .git has no worktree' '\n \t\t\"$here/16c/.git\" \"(null)\" \"$here/16c/sub\" \"(null)\"\n '\n \n-test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is ignored (bare case)' '\n+test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is reluctantly accepted (bare case)' '\n \t# Just like #16.\n \tsetup_repo 17a unset \"\" true &&\n \tsetup_repo 17b unset \"\" true &&\n \tmkdir -p 17a/.git/wt/sub &&\n \tmkdir -p 17b/.git/wt/sub &&\n \n-\ttry_case 17a/.git non-existent unset \\\n-\t\t. \"(null)\" \"$here/17a/.git\" \"(null)\" &&\n-\ttry_case 17a/.git/wt non-existent unset \\\n-\t\t\"$here/17a/.git\" \"(null)\" \"$here/17a/.git/wt\" \"(null)\" &&\n-\ttry_case 17a/.git/wt/sub non-existent unset \\\n-\t\t\"$here/17a/.git\" \"(null)\" \"$here/17a/.git/wt/sub\" \"(null)\" &&\n+\ttry_case 17a/.git \"$here/17a\" unset \\\n+\t\t\"$here/17a/.git\" \"$here/17a\" \"$here/17a\" .git/ \\\n+\t\t2>message &&\n+\ttry_case 17a/.git/wt \"$here/17a\" unset \\\n+\t\t\"$here/17a/.git\" \"$here/17a\" \"$here/17a\" .git/wt/ &&\n+\ttry_case 17a/.git/wt/sub \"$here/17a\" unset \\\n+\t\t\"$here/17a/.git\" \"$here/17a\" \"$here/17a\" .git/wt/sub/ &&\n \n-\ttry_case 17b/.git non-existent unset \\\n-\t\t. \"(null)\" \"$here/17b/.git\" \"(null)\" &&\n-\ttry_case 17b/.git/wt non-existent unset \\\n-\t\t\"$here/17b/.git\" \"(null)\" \"$here/17b/.git/wt\" \"(null)\" &&\n-\ttry_case 17b/.git/wt/sub non-existent unset \\\n-\t\t\"$here/17b/.git\" \"(null)\" \"$here/17b/.git/wt/sub\" \"(null)\" &&\n+\ttry_case 17b/.git \"$here/17b\" unset \\\n+\t\t\"$here/17b/.git\" \"$here/17b\" \"$here/17b\" .git/ &&\n+\ttry_case 17b/.git/wt \"$here/17b\" unset \\\n+\t\t\"$here/17b/.git\" \"$here/17b\" \"$here/17b\" .git/wt/ &&\n+\ttry_case 17b/.git/wt/sub \"$here/17b\" unset \\\n+\t\t\"$here/17b/.git\" \"$here/17b\" \"$here/17b\" .git/wt/sub/ &&\n \n-\ttry_repo 17c non-existent unset unset \"\" true \\\n-\t\t.git \"(null)\" \"$here/17c\" \"(null)\" \\\n-\t\t\"$here/17c/.git\" \"(null)\" \"$here/17c/sub\" \"(null)\"\n+\ttry_repo 17c \"$here/17c\" unset unset \"\" true \\\n+\t\t.git \"$here/17c\" \"$here/17c\" \"(null)\" \\\n+\t\t\"$here/17c/.git\" \"$here/17c\" \"$here/17c\" sub/ 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n test_expect_success '#18: bare .git named by GIT_DIR has no worktree' '\n@@ -541,56 +558,43 @@ test_expect_success '#19: setup' '\n '\n run_wt_tests 19\n \n-test_expect_success '#20a: core.worktree without GIT_DIR ignored (inside .git)' '\n-\t# Just like case #16a.\n-\tsetup_repo 20a non-existent \"\" unset &&\n+test_expect_success '#20a: core.worktree without GIT_DIR reluctantly accepted (inside .git)' '\n+\t# Unlike case #16a.\n+\tsetup_repo 20a \"$here/20a\" \"\" unset &&\n \tmkdir -p 20a/.git/wt/sub &&\n \ttry_case 20a/.git unset unset \\\n-\t\t. \"(null)\" \"$here/20a/.git\" \"(null)\" &&\n+\t\t\"$here/20a/.git\" \"$here/20a\" \"$here/20a\" .git/ 2>message &&\n \ttry_case 20a/.git/wt unset unset \\\n-\t\t\"$here/20a/.git\" \"(null)\" \"$here/20a/.git/wt\" \"(null)\" &&\n+\t\t\"$here/20a/.git\" \"$here/20a\" \"$here/20a\" .git/wt/ &&\n \ttry_case 20a/.git/wt/sub unset unset \\\n-\t\t\"$here/20a/.git\" \"(null)\" \"$here/20a/.git/wt/sub\" \"(null)\"\n+\t\t\"$here/20a/.git\" \"$here/20a\" \"$here/20a\" .git/wt/sub/ &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n-test_expect_success '#20b/c: core.worktree without GIT_DIR ignored (bare repository)' '\n-\t# Just like case #16b/c.\n+test_expect_success '#20b/c: core.worktree and core.bare conflict' '\n \tsetup_repo 20b non-existent \"\" true &&\n \tmkdir -p 20b/.git/wt/sub &&\n-\ttry_case 20b/.git unset unset \\\n-\t\t. \"(null)\" \"$here/20b/.git\" \"(null)\" &&\n-\ttry_case 20b/.git/wt unset unset \\\n-\t\t\"$here/20b/.git\" \"(null)\" \"$here/20b/.git/wt\" \"(null)\" &&\n-\ttry_case 20b/.git/wt/sub unset unset \\\n-\t\t\"$here/20b/.git\" \"(null)\" \"$here/20b/.git/wt/sub\" \"(null)\" &&\n-\ttry_repo 20c unset unset non-existent \"\" true \\\n-\t\t.git \"(null)\" \"$here/20c\" \"(null)\" \\\n-\t\t\"$here/20c/.git\" \"(null)\" \"$here/20c/sub\" \"(null)\"\n+\t(\n+\t\tcd 20b/.git &&\n+\t\ttest_must_fail git symbolic-ref HEAD >/dev/null\n+\t) 2>message &&\n+\tgrep \"core.bare and core.worktree\" message\n '\n \n-test_expect_success '#21: core.worktree+GIT_WORK_TREE without GIT_DIR ignored (bare cases)' '\n-\tsetup_repo 21a non-existent \"\" unset &&\n-\tmkdir -p 21a/.git/wt/sub &&\n-\ttry_case 21a/.git non-existent-too unset \\\n-\t\t. \"(null)\" \"$here/21a/.git\" \"(null)\" &&\n-\ttry_case 21a/.git/wt non-existent-too unset \\\n-\t\t\"$here/21a/.git\" \"(null)\" \"$here/21a/.git/wt\" \"(null)\" &&\n-\ttry_case 21a/.git/wt/sub non-existent-too unset \\\n-\t\t\"$here/21a/.git\" \"(null)\" \"$here/21a/.git/wt/sub\" \"(null)\" &&\n+# Case #21: core.worktree/GIT_WORK_TREE reluctantly overrides core.bare' '\n+test_expect_success '#21: setup, core.worktree warns before overriding core.bare' '\n+\tsetup_repo 21 non-existent \"\" unset &&\n+\tmkdir -p 21/.git/wt/sub &&\n+\t(\n+\t\tcd 21/.git &&\n+\t\tGIT_WORK_TREE=\"$here/21\" &&\n+\t\texport GIT_WORK_TREE &&\n+\t\tgit symbolic-ref HEAD >/dev/null\n+\t) 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n \n-\tsetup_repo 21b non-existent \"\" true &&\n-\tmkdir -p 21b/.git/wt/sub &&\n-\ttry_case 21b/.git non-existent-too unset \\\n-\t\t. \"(null)\" \"$here/21b/.git\" \"(null)\" &&\n-\ttry_case 21b/.git/wt non-existent-too unset \\\n-\t\t\"$here/21b/.git\" \"(null)\" \"$here/21b/.git/wt\" \"(null)\" &&\n-\ttry_case 21b/.git/wt/sub non-existent-too unset \\\n-\t\t\"$here/21b/.git\" \"(null)\" \"$here/21b/.git/wt/sub\" \"(null)\" &&\n-\n-\ttry_repo 21c non-existent-too unset non-existent \"\" true \\\n-\t\t.git \"(null)\" \"$here/21c\" \"(null)\" \\\n-\t\t\"$here/21c/.git\" \"(null)\" \"$here/21c/sub\" \"(null)\"\n '\n+run_wt_tests 21\n \n test_expect_success '#22a: core.worktree = GIT_DIR = .git dir' '\n \t# like case #6.\n@@ -699,10 +703,11 @@ test_expect_success '#24: bare repo has no worktree (gitfile case)' '\n \t\t\"$here/24.git\" \"(null)\" \"$here/24/sub\" \"(null)\"\n '\n \n-test_expect_success '#25: GIT_WORK_TREE ignored if GIT_DIR unset (bare gitfile case)' '\n-\ttry_repo 25 non-existent unset unset gitfile true \\\n-\t\t\"$here/25.git\" \"(null)\" \"$here/25\" \"(null)\" \\\n-\t\t\"$here/25.git\" \"(null)\" \"$here/25/sub\" \"(null)\"\n+test_expect_success '#25: GIT_WORK_TREE accepted reluctantly if GIT_DIR unset (bare gitfile case)' '\n+\ttry_repo 25 \"$here/25\" unset unset gitfile true \\\n+\t\t\"$here/25.git\" \"$here/25\" \"$here/25\" \"(null)\"  \\\n+\t\t\"$here/25.git\" \"$here/25\" \"$here/25\" \"sub/\" 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n \n test_expect_success '#26: bare repo has no worktree (GIT_DIR -> gitfile case)' '\n@@ -721,17 +726,29 @@ test_expect_success '#27: setup' '\n '\n run_wt_tests 27 gitfile\n \n-test_expect_success '#28: core.worktree ignored if GIT_DIR unset (bare gitfile case)' '\n-\ttry_repo 28 unset unset non-existent gitfile true \\\n-\t\t\"$here/28.git\" \"(null)\" \"$here/28\" \"(null)\" \\\n-\t\t\"$here/28.git\" \"(null)\" \"$here/28/sub\" \"(null)\"\n+test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '\n+\tsetup_repo 28 \"$here/28\" gitfile true &&\n+\t(\n+\t\tcd 28 &&\n+\t\ttest_must_fail git symbolic-ref HEAD\n+\t) 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message &&\n+\tgrep \"core.bare and core.worktree\" message\n '\n \n-test_expect_success '#29: GIT_WORK_TREE+core.worktree ignored if GIT_DIR unset (bare gitfile case)' '\n-\ttry_repo 29 non-existent-too unset non-existent gitfile true \\\n-\t\t\"$here/29.git\" \"(null)\" \"$here/29\" \"(null)\" \\\n-\t\t\"$here/29.git\" \"(null)\" \"$here/29/sub\" \"(null)\"\n+# Case #29: GIT_WORK_TREE(+core.worktree) reluctantly overries core.bare (gitfile case).\n+test_expect_success '#29: setup' '\n+\tsetup_repo 29 non-existent gitfile true &&\n+\tmkdir -p 29/sub/sub 29/wt/sub\n+\t(\n+\t\tcd 29 &&\n+\t\tGIT_WORK_TREE=\"$here/29\" &&\n+\t\texport GIT_WORK_TREE &&\n+\t\tgit symbolic-ref HEAD >/dev/null\n+\t) 2>message &&\n+\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n '\n+run_wt_tests 29 gitfile\n \n test_expect_success '#30: core.worktree and core.bare conflict (gitfile version)' '\n \t# Just like case #22.\n-- \n1.7.4.rc2\n"},{"id":"159645","messageId":"20110119130524.GB22496@burratino","threadId":"25845","inReplyTo":"20110119123732.GA23222@burratino","subject":"Re: [PATCH/RFC 0/3] setup: stop ignoring GIT_WORK_TREE (when GIT_DIR is unset)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T13:05:24Z","receivedAt":"2011-01-19T13:05:24Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n>   tests: cosmetic improvements to the repo-setup test\n>   tests: make the setup tests briefer\n>   setup: stop ignoring GIT_WORK_TREE and core.worktree\n> \n>  setup.c               |   27 +-\n>  t/t1510-repo-setup.sh | 5166 +++++++------------------------------------------\n>  2 files changed, 729 insertions(+), 4464 deletions(-)\n\nIt seems that the second patch was too long to send by mail.  The\nseries can be retrieved by git at\n\n git://repo.or.cz/git/jrn.git worktree-with-implicit-git-dir\n\nPatches are based on js/test-windows to avoid semantically\nuninteresting conflicts.\n"},{"id":"159650","messageId":"AANLkTinE5gNZM_HDJq31qs5ARJn-DrO9HW66cszTayPa@mail.gmail.com","threadId":"25845","inReplyTo":"20110119124230.GD23222@burratino","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-01-19T14:48:57Z","receivedAt":"2011-01-19T14:48:57Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/1/19 Jonathan Nieder <jrnieder@gmail.com>:\n> @@ -411,6 +411,16 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n>        if (check_repository_format_gently(gitdir, nongit_ok))\n>                return NULL;\n>\n> +       /* Accept --work-tree to support old scripts that played with fire. */\n> +       if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n\nCan we leave git_work_tree_cfg out? If this code is to support misused\nscripts, then $GIT_WORK_TREE alone ought to be enough. I don't think\nany scripts would use core.worktree. Most of worktree headache comes\nfrom core.worktree, not $GIT_WORK_TREE. Granted though the situation\nis better now that we don't set worktree in setup_git_directory().\n\n> +               warning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n\nWhat if core.worktree is set, not $GIT_WORK_TREE? In my opinion\n\n> +               if (offset != len && !is_absolute_path(gitdir))\n> +                       gitdir = xstrdup(make_absolute_path(gitdir));\n\nThe behavior regarding relative $GIT_WORK_TREE before nd/setup series\nis inconsistent. If setup_git_directory() is used, work_tree is\nrelative to user's cwd. In other cases, when get_git_work_tree() is\ncalled, work_tree is made absolute relative to _current_ cwd (usually\nat discovered work_tree root). Which way do you want to keep?\n-- \nDuy\n"},{"id":"159653","messageId":"4D373296.6030101@seznam.cz","threadId":"25845","inReplyTo":"20110119124230.GD23222@burratino","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Maaartin","fromEmail":"grajcar1@seznam.cz","sentAt":"2011-01-19T18:51:02Z","receivedAt":"2011-01-19T18:51:02Z","isPatch":true,"sender":{"key":"grajcar1@seznam.cz","avatar":null},"body":"On 11-01-19 13:42, Jonathan Nieder wrote:\n> Unfortunately the existence of GIT_WORK_TREE makes it tempting to\n> use without setting GIT_DIR.\n\nMaybe I'm asking nonsense, but why should I always use both? On the\ncommand line, I either cd to my (alternate) working tree and use GIT_DIR\nonly or the other way round. I used both several times when I wanted to\ncompare the (normal) working tree with another commit using something\nbetter than git-diff (git-difftool didn't work for me on cygwin).\n"},{"id":"159654","messageId":"20110119190304.GA30618@burratino","threadId":"25845","inReplyTo":"20110119124230.GD23222@burratino","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T19:03:04Z","receivedAt":"2011-01-19T19:03:04Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -509,8 +532,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n>  \t * validation.\n>  \t */\n>  \tgitdirenv = getenv(GIT_DIR_ENVIRONMENT);\n> -\tif (gitdirenv)\n> +\tif (gitdirenv) {\n> +\t\ttrace_printf(\"trace: gitdirenv = %s\\n\", gitdirenv);\n>  \t\treturn setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);\n> +\t}\n>  \n\nThe above hunk is a debugging remnant.  I suppose it was foolish to\nsend out the series so late.  Probably not such a big deal since the\nproblem Maaartin mentioned remains anyway (that is, the warning is\nstill confusing).\n\n-- 8< --\nSubject: fixup! setup: always honor GIT_WORK_TREE and core.worktree\n\nRemove noisy debug code.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\ndiff --git b/setup.c a/setup.c\nindex c0f5846..e08cdf2 100644\n--- b/setup.c\n+++ a/setup.c\n@@ -532,10 +532,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)\n \t * validation.\n \t */\n \tgitdirenv = getenv(GIT_DIR_ENVIRONMENT);\n-\tif (gitdirenv) {\n-\t\ttrace_printf(\"trace: gitdirenv = %s\\n\", gitdirenv);\n+\tif (gitdirenv)\n \t\treturn setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);\n-\t}\n \n \tceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);\n \tif (ceil_offset < 0 && has_dos_drive_prefix(cwd))\n"},{"id":"159655","messageId":"7vei88u2os.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"20110119124230.GD23222@burratino","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-19T19:13:39Z","receivedAt":"2011-01-19T19:13:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> In the usual case, git commands are run from within a git worktree.\n> The toplevel directory and associated .git dir are found by chdir-ing\n> to .. repeatedly until .git is a valid repository.\n>\n> That behavior can be overridden in two ways.\n\nHmm, I wouldn't call them \"two ways\".\n\nWe originally had GIT_DIR and people who wanted to use a working tree\nwithout an embedded .git (hence having to use GIT_DIR) complained that\nthey cannot work from subdirectories while cd'ing around; GIT_WORK_TREE\nwas added to augment the mechanism to allow them to specify where their\nroot is.  Saying \"two ways\" sounds as if it is sane to do one without\ndoing the other, which is not the case here.\n\nFor the same reason (another tangent), although t1510 seems to have\ncomplex rules about \"relative to\", it does not make much sense to specify\na path in GIT_WORK_TREE relative to user's $cwd.  The mechanism is to\nallow people to chdir around inside their working tree that does not have\nan embedded .git directory to begin with.\n\n> diff --git a/setup.c b/setup.c\n> index 3d73269..c0f5846 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -411,6 +411,16 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n>  \tif (check_repository_format_gently(gitdir, nongit_ok))\n>  \t\treturn NULL;\n>  \n> +\t/* Accept --work-tree to support old scripts that played with fire. */\n> +\tif (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n> +\t\twarning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n> +\t\tif (offset != len && !is_absolute_path(gitdir))\n> +\t\t\tgitdir = xstrdup(make_absolute_path(gitdir));\n> +\t\tif (chdir(cwd))\n> +\t\t\tdie_errno(\"Could not come back to cwd\");\n> +\t\treturn setup_explicit_git_dir(gitdir, cwd, len, nongit_ok);\n> +\t}\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> @@ -443,6 +453,19 @@ static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongi\n>  \tif (check_repository_format_gently(\".\", nongit_ok))\n>  \t\treturn NULL;\n>  \n> +\t/*\n> +\t * Accept --work-tree, reluctantly.\n> +\t */\n> +\tif (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n> +\t\tconst char *gitdir;\n> +\n> +\t\twarning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n> +\t\tgitdir = offset == len ? \".\" : xmemdupz(cwd, offset);\n> +\t\tif (chdir(cwd))\n> +\t\t\tdie_errno(\"Could not come back to cwd\");\n> +\t\treturn setup_explicit_git_dir(gitdir, cwd, len, nongit_ok);\n> +\t}\n> +\n>  \tinside_git_dir = 1;\n>  \tinside_work_tree = 0;\n>  \tif (offset != len) {\n\nThis seems to be a good workaround to resurrect the historical buggy\nbehaviour, but it makes the already ugly code even uglier. Can we do\nsomething about it?\n\nI wonder if it would make it more readable if we restructure\nsetup_git_directory_gently_1() slightly, perhaps by making the loop to\ndiscover the .git directory/file into a separate helper function that\nreturns:\n\n - the path to the discovered .git;\n - if the .git was found as an ancestor of the original $cwd (to handle \"bare\");\n - if the discovery was aborted due to ceiling (or hitting root);\n\nand make the caller decide what kind of setup to call outside the loop.\n\nBut that is a minor point.\n"},{"id":"159657","messageId":"7v4o94u26f.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"4D373296.6030101@seznam.cz","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-19T19:24:40Z","receivedAt":"2011-01-19T19:24:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Maaartin <grajcar1@seznam.cz> writes:\n\n> On 11-01-19 13:42, Jonathan Nieder wrote:\n>> Unfortunately the existence of GIT_WORK_TREE makes it tempting to\n>> use without setting GIT_DIR.\n>\n> Maybe I'm asking nonsense, but why should I always use both? On the\n> command line, I either cd to my (alternate) working tree and use GIT_DIR\n> only or the other way round.\n\nAs long as you were at the root level of these two sets of \"working trees\",\nyou don't need GIT_WORK_TREE at all.\n\nWe originally had only GIT_DIR and people who wanted to use a working tree\nwithout an embedded .git (hence having to use GIT_DIR) complained that\nthey cannot work from subdirectories while cd'ing around, because you\ndeclare that you are at the root of your working tree by using GIT_DIR\n(naturally, there is no discovery of .git so we won't know where the root\nis).  GIT_WORK_TREE was added to augment the mechanism to allow them to\nspecify where their root is, so that they can set both and then chdir\naround inside their working tree.\n"},{"id":"159660","messageId":"20110119193116.GB30618@burratino","threadId":"25845","inReplyTo":"AANLkTinE5gNZM_HDJq31qs5ARJn-DrO9HW66cszTayPa@mail.gmail.com","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T19:31:16Z","receivedAt":"2011-01-19T19:31:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n> 2011/1/19 Jonathan Nieder <jrnieder@gmail.com>:\n\n>> @@ -411,6 +411,16 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n>>        if (check_repository_format_gently(gitdir, nongit_ok))\n>>                return NULL;\n>>\n>> +       /* Accept --work-tree to support old scripts that played with fire. */\n>> +       if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n>\n> Can we leave git_work_tree_cfg out? If this code is to support misused\n> scripts, then $GIT_WORK_TREE alone ought to be enough.\n\nSure, it would be easy to exclude git_work_tree_cfg here.  I guess the\nrelevant question is\n\nMaaartin wrote:\n> On 11-01-19 13:42, Jonathan Nieder wrote:\n\n>> Unfortunately the existence of GIT_WORK_TREE makes it tempting to\n>> use without setting GIT_DIR.\n>\n> Maybe I'm asking nonsense, but why should I always use both?\n\nThat is, why do we want to discourage setting the work tree without\nGIT_DIR in the first place?\n\nThe issues seem to be:\n\n1. Previously there was some confusion about what path the worktree\n   is relative to.  Now setup_explicit_git_dir makes it clear:\n   + GIT_WORK_TREE and --work-tree are relative to the original cwd;\n   + the \"[core] worktree\" setting is relative to the gitdir.\n\n2. Previously there was some confusion about the right order of\n   operations --- move to worktree first, or find the git dir?\n   Now the setup procedure is clearly \"first find git dir, then\n   act on worktree\".\n\n3. A global \"[core] worktree\" setting with relative path is\n   nonsensical since there is not necessarily a gitdir for it to be\n   relative to.\n\n4. Likewise, setting GIT_WORK_TREE when outside any git repository\n   has no clear meaning.\n\n5. The interaction with core.bare and implicit bareness are not\n   obvious.  Clearly core.bare should conflict with core.worktree,\n   but can GIT_WORK_TREE override that?  Maybe\n   check_repository_format_gently is the right place for this check\n   (rather than the setup procedure).\n\n(1) and (2) have been resolved by your work (nice!), (3) seems like\na case of \"don't do that, then\", and (4) out to error out in\nsetup_nongit (though my patch doesn't take care of that).  Given an\nanswer to (5) we could wholeheartedly and consistently support\nworktree with implicit gitdir, as a new feature.\n\nIs that a fair summary?\n\n[...]\n>> +               if (offset != len && !is_absolute_path(gitdir))\n>> +                       gitdir = xstrdup(make_absolute_path(gitdir));\n>\n> The behavior regarding relative $GIT_WORK_TREE before nd/setup series\n> is inconsistent. If setup_git_directory() is used, work_tree is\n> relative to user's cwd. In other cases, when get_git_work_tree() is\n> called, work_tree is made absolute relative to _current_ cwd (usually\n> at discovered work_tree root). Which way do you want to keep?\n\nThe former.  But this is worrisome: scripts using cd_to_toplevel are\ngetting the latter behavior.  Maybe a warning for relative\nGIT_WORK_TREE is in order, like you hinted before.\n"},{"id":"159669","messageId":"7vpqrssl5d.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"20110119193116.GB30618@burratino","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-19T20:17:50Z","receivedAt":"2011-01-19T20:17:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Maaartin wrote:\n>> On 11-01-19 13:42, Jonathan Nieder wrote:\n>\n>>> Unfortunately the existence of GIT_WORK_TREE makes it tempting to\n>>> use without setting GIT_DIR.\n>>\n>> Maybe I'm asking nonsense, but why should I always use both?\n>\n> That is, why do we want to discourage setting the work tree without\n> GIT_DIR in the first place?\n\nI read that one quite differently.  Maaartin was always at the root level\nand did not need GIT_WORK_TREE, and in such a case there is no need to use\nboth.  Only GIT_DIR is needed.\n\n    This is a tangent, because I just said what Maaartin said is\n    irrelevant to the question \"Why do I have to set GIT_DIR when I want\n    to set GIT_WORK_TREE?\", which is what you are discussing, but I\n    suspect Maaartin was not getting the correct output from diff commands\n    by having two sets of \"working tree\" looking files, chdir'ing to their\n    root level and having a single GIT_DIR, and was not noticing it.  It\n    should _not_ work: think \"index\".\n\nThe answer to your question might be your question itself, though.\n\nHaving said that, thanks for a nice summary.\n\n> 1. Previously there was some confusion about what path the worktree\n>    is relative to.  Now setup_explicit_git_dir makes it clear:\n>    + GIT_WORK_TREE and --work-tree are relative to the original cwd;\n>    + the \"[core] worktree\" setting is relative to the gitdir.\n\nGood.  I earlier said that relative GIT_WORK_TREE does not make much\nsense, but I wasn't (and I am not) opposed to the above definition.  It is\njust that\n\n\tGIT_DIR=/some/where; export GIT_DIR\n        cd /some/other/place\n        GIT_WORK_TREE=. git reset --hard\n\tcd onelevel\n\tedit edit edit\n        GIT_WORK_TREE=.. git add file\n        cd twolevels\n        edit edit edit\n        GIT_WORK_TREE=../.. git add file\n\t...\n\nwould be a much more cumbersome thing to do compared to:\n\n\tGIT_WORK_TREE=/some/other/place; export GIT_WORK_TREE\n        cd $(GIT_WORK_TREE)\n        git reset --hard\n\tcd onelevel\n\tedit edit edit\n\tgit add file\n        cd twolevels\n        edit edit edit\n        git add file\n\t...\n\n> 5. The interaction with core.bare and implicit bareness are not\n>    obvious.  Clearly core.bare should conflict with core.worktree,\n>    but can GIT_WORK_TREE override that?  Maybe\n>    check_repository_format_gently is the right place for this check\n>    (rather than the setup procedure).\n\nIIRC, we on purpose added support to allow GIT_WORK_TREE to tentatively\nlift bareness of a repository so that people can\n\n\tcd /var/tmp\n        GIT_WORK_TREE=. git --git-dir=/srv/git/jgit.git checkout -f\n\nto get a snapshot easily.\n\n> (1) and (2) have been resolved by your work (nice!), (3) seems like\n> a case of \"don't do that, then\", and (4) out to error out in\n> setup_nongit (though my patch doesn't take care of that).  Given an\n> answer to (5) we could wholeheartedly and consistently support\n> worktree with implicit gitdir, as a new feature.\n\nAs long as we really can support it _consistently_, I wouldn't see a big\nproblem in resurrecting the historical accident as a feature.  You earlier\nsaid gitolite also misuses the interface, but does the usage pattern it\nhas the same as the one in the debian script you had trouble with, and do\nthey expect the same behaviour?\n"},{"id":"159670","messageId":"4D374B04.80500@seznam.cz","threadId":"25845","inReplyTo":"7v4o94u26f.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Maaartin","fromEmail":"grajcar1@seznam.cz","sentAt":"2011-01-19T20:35:16Z","receivedAt":"2011-01-19T20:35:16Z","isPatch":true,"sender":{"key":"grajcar1@seznam.cz","avatar":null},"body":"On 11-01-19 20:24, Junio C Hamano wrote:\n> Maaartin <grajcar1@seznam.cz> writes:\n> \n>> On 11-01-19 13:42, Jonathan Nieder wrote:\n>>> Unfortunately the existence of GIT_WORK_TREE makes it tempting to\n>>> use without setting GIT_DIR.\n>>\n>> Maybe I'm asking nonsense, but why should I always use both? On the\n>> command line, I either cd to my (alternate) working tree and use GIT_DIR\n>> only or the other way round.\n> \n> As long as you were at the root level of these two sets of \"working trees\",\n> you don't need GIT_WORK_TREE at all.\n\nActually I did mostly something like\n\ngit --work-tree /tmp/somewhere checkout somebranch -- .\n  && winmerge . /tmp/somewhere\n\nat root of my normal work tree as a poor man's replacement for\n\ngit difftool somebranch\n\nThis is probably no good idea as it mixes up the index. Sorry for\nmisusing this thread, but a side question: Should I specify\nGIT_INDEX_FILE or is there a better way?\n\nBtw., I see that GIT_INDEX_FILE is relative to the work tree instead of\nto the git dir. I find it strange as it's normally a part of the git dir.\n\n> We originally had only GIT_DIR and people who wanted to use a working tree\n> without an embedded .git (hence having to use GIT_DIR) complained that\n> they cannot work from subdirectories while cd'ing around, because you\n> declare that you are at the root of your working tree by using GIT_DIR\n> (naturally, there is no discovery of .git so we won't know where the root\n> is).  GIT_WORK_TREE was added to augment the mechanism to allow them to\n> specify where their root is, so that they can set both and then chdir\n> around inside their working tree.\n\nThat's nice.\n"},{"id":"159671","messageId":"20110119205257.GA31029@burratino","threadId":"25845","inReplyTo":"4D374B04.80500@seznam.cz","subject":"checkout to other directory (Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-19T20:52:57Z","receivedAt":"2011-01-19T20:52:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Maaartin wrote:\n\n> Actually I did mostly something like\n>\n> git --work-tree /tmp/somewhere checkout somebranch -- .\n>   && winmerge . /tmp/somewhere\n>\n> at root of my normal work tree as a poor man's replacement for\n>\n> git difftool somebranch\n>\n> This is probably no good idea as it mixes up the index.\n\nRight.  I think the simplest (and usual) method is something like\n\n\trm -fr /tmp/somewhere &&\n\tmkdir -p /tmp/somewhere &&\n\tgit archive somebranch | (cd /tmp/somewhere && tar -xf -)\n\nBut suppose that the tracked tree is very big, so that re-creating\n/tmp/somewhere each time is expensive.  Then you can do\n\n\t(\n\t\tGIT_DIR=$(pwd)/.git &&\n\t\tGIT_INDEX_FILE=$(pwd)/.git/somewhere-index &&\n\t\texport GIT_DIR GIT_INDEX_FILE &&\n\n\t\tcd /tmp/somewhere &&\n\t\tgit update-index --refresh -q &&\n\t\tgit read-tree --reset -m -u somebranch\n\t)\n\nThe state of /tmp/somewhere is remembered in the somewhere-index file.\n\nIn practice, I tend to use something closer to the following:\n\n\tsh /usr/share/doc/git/contrib/git-new-workdir repo /tmp/somewhere &&\n\t(\n\t\tcd /tmp/somewhere &&\n\t\tgit checkout somebranch^0\n\t)\n\nSee [1] for caveats and future directions.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/150559\n"},{"id":"159770","messageId":"7v39omotxg.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"7vpqrssl5d.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-21T20:58:35Z","receivedAt":"2011-01-21T20:58:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Having said that, thanks for a nice summary.\n> ...\n>\n>> 5. The interaction with core.bare and implicit bareness are not\n>>    obvious.  Clearly core.bare should conflict with core.worktree,\n>>    but can GIT_WORK_TREE override that?  Maybe\n>>    check_repository_format_gently is the right place for this check\n>>    (rather than the setup procedure).\n>\n> IIRC, we on purpose added support to allow GIT_WORK_TREE to tentatively\n> lift bareness of a repository so that people can\n>\n> \tcd /var/tmp\n>         GIT_WORK_TREE=. git --git-dir=/srv/git/jgit.git checkout -f\n>\n> to get a snapshot easily.\n>\n>> (1) and (2) have been resolved by your work (nice!), (3) seems like\n>> a case of \"don't do that, then\", and (4) out to error out in\n>> setup_nongit (though my patch doesn't take care of that).  Given an\n>> answer to (5) we could wholeheartedly and consistently support\n>> worktree with implicit gitdir, as a new feature.\n>\n> As long as we really can support it _consistently_, I wouldn't see a big\n> problem in resurrecting the historical accident as a feature.  You earlier\n> said gitolite also misuses the interface, but does the usage pattern it\n> has the same as the one in the debian script you had trouble with, and do\n> they expect the same behaviour?\n\nI was re-reading this thread, and changed my mind; I think we should have\nthis series to avoid unnecessary regression, with or without clarifying\n(5), before 1.7.4 final.\n\nEven if some scripts you had trouble with started using GIT_WORK_TREE\nwithout specifying GIT_DIR because they misunderstood what these are\ndesigned to do, as long as the combination has been working consistently\nwith the expectation of these scripts, ans as long as we can keep the same\nbehaviour, I don't see a reason to change it.\n"},{"id":"159773","messageId":"7vtyh1oqy8.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"7v39omotxg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-21T22:02:55Z","receivedAt":"2011-01-21T22:02:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I was re-reading this thread, and changed my mind; I think we should have\n> this series to avoid unnecessary regression, with or without clarifying\n> (5), before 1.7.4 final.\n>\n> Even if some scripts you had trouble with started using GIT_WORK_TREE\n> without specifying GIT_DIR because they misunderstood what these are\n> designed to do, as long as the combination has been working consistently\n> with the expectation of these scripts, ans as long as we can keep the same\n> behaviour, I don't see a reason to change it.\n\n... and that leads me to suggest that we may not even want to issue a\nwarning in these cases.\n\nPerhaps squash this into, or apply on top of, your 3/3?\n\n-- >8 --\nSubject: setup: officially support --work-tree without --git-dir\n\nThe original intention of --work-tree was to allow people to work in a\nsubdirectory of their working tree that does not have an embedded .git\ndirectory.  Because their working tree, which their $cwd was in, did not\nhave an embedded .git, they needed to use $GIT_DIR to specify where it is,\nand because this meant there was no way to discover where the root level\nof the working tree was, so we needed to add $GIT_WORK_TREE to tell git\nwhere it was.\n\nHowever, this facility has long been (mis)used by people's scripts to\nstart git from a working tree _with_ an embedded .git directory, let git\nfind .git directory, and then pretend as if an unrelated directory were\nthe associated working tree of the .git directory found by the discovery\nprocess.  It happens to work in simple cases, and is not worth causing\n\"regression\" to these scripts.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n setup.c               |    8 +-----\n t/t1510-repo-setup.sh |   59 +++++++++++++++++++++++++-----------------------\n 2 files changed, 33 insertions(+), 34 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex e08cdf2..dadc666 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -411,9 +411,8 @@ static const char *setup_discovered_git_dir(const char *gitdir,\n \tif (check_repository_format_gently(gitdir, nongit_ok))\n \t\treturn NULL;\n \n-\t/* Accept --work-tree to support old scripts that played with fire. */\n+\t/* --work-tree is set without --git-dir; use discovered one */\n \tif (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n-\t\twarning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n \t\tif (offset != len && !is_absolute_path(gitdir))\n \t\t\tgitdir = xstrdup(make_absolute_path(gitdir));\n \t\tif (chdir(cwd))\n@@ -453,13 +452,10 @@ static const char *setup_bare_git_dir(char *cwd, int offset, int len, int *nongi\n \tif (check_repository_format_gently(\".\", nongit_ok))\n \t\treturn NULL;\n \n-\t/*\n-\t * Accept --work-tree, reluctantly.\n-\t */\n+\t/* --work-tree is set without --git-dir; use discovered one */\n \tif (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) {\n \t\tconst char *gitdir;\n \n-\t\twarning(\"pretending GIT_DIR was supplied alongside GIT_WORK_TREE\");\n \t\tgitdir = offset == len ? \".\" : xmemdupz(cwd, offset);\n \t\tif (chdir(cwd))\n \t\t\tdie_errno(\"Could not come back to cwd\");\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex b8a1b02..dcc0f86 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -16,9 +16,12 @@ A few rules for repo setup:\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 meant to work if GIT_DIR is set.\n-   Otherwise there is a warning and a best effort is made to follow\n-   historical behavior.\n+5. GIT_WORK_TREE/core.worktree was originally meant to work only if\n+   GIT_DIR is set, but earlier git didn't enforce it, and some scripts\n+   depend on the implementation that happened to first discover .git by\n+   going up from the users $cwd and then using the specified working tree\n+   that may or may not have any relation to where .git was found in.  This\n+   historical behaviour must be kept.\n \n 6. Effective GIT_WORK_TREE overrides core.worktree and core.bare\n \n@@ -225,16 +228,16 @@ try_repo () {\n test_expect_success '#0: nonbare repo, no explicit configuration' '\n \ttry_repo 0 unset unset unset \"\" unset \\\n \t\t.git \"$here/0\" \"$here/0\" \"(null)\" \\\n-\t\t.git \"$here/0\" \"$here/0\" sub/ 2>messages &&\n-\t! grep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" messages\n+\t\t.git \"$here/0\" \"$here/0\" sub/ 2>message &&\n+\t! test -s message\n '\n \n-test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is reluctantly accepted' '\n+test_expect_success '#1: GIT_WORK_TREE without explicit GIT_DIR is accepted' '\n \tmkdir -p wt &&\n \ttry_repo 1 \"$here\" unset unset \"\" unset \\\n \t\t\"$here/1/.git\" \"$here\" \"$here\" 1/ \\\n \t\t\"$here/1/.git\" \"$here\" \"$here\" 1/sub/ 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n test_expect_success '#2: worktree defaults to cwd with explicit GIT_DIR' '\n@@ -255,16 +258,16 @@ test_expect_success '#3: setup' '\n '\n run_wt_tests 3\n \n-test_expect_success '#4: core.worktree without GIT_DIR set is reluctantly accepted' '\n+test_expect_success '#4: core.worktree without GIT_DIR set is accepted' '\n \tsetup_repo 4 ../sub \"\" unset &&\n \tmkdir -p 4/sub sub &&\n \ttry_case 4 unset unset \\\n \t\t.git \"$here/4/sub\" \"$here/4\" \"(null)\" \\\n \t\t\"$here/4/.git\" \"$here/4/sub\" \"$here/4/sub\" \"(null)\" 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n-test_expect_success '#5: core.worktree + GIT_WORK_TREE is reluctantly accepted' '\n+test_expect_success '#5: core.worktree + GIT_WORK_TREE is accepted' '\n \t# or: you cannot intimidate away the lack of GIT_DIR setting\n \ttry_repo 5 \"$here\" unset \"$here/5\" \"\" unset \\\n \t\t\"$here/5/.git\" \"$here\" \"$here\" 5/ \\\n@@ -272,7 +275,7 @@ test_expect_success '#5: core.worktree + GIT_WORK_TREE is reluctantly accepted'\n \ttry_repo 5a .. unset \"$here/5a\" \"\" unset \\\n \t\t\"$here/5a/.git\" \"$here\" \"$here\" 5a/ \\\n \t\t\"$here/5a/.git\" \"$here/5a\" \"$here/5a\" sub/ &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n test_expect_success '#6: setting GIT_DIR brings core.worktree to life' '\n@@ -364,12 +367,12 @@ test_expect_success '#8: gitfile, easy case' '\n \t\t\"$here/8.git\" \"$here/8\" \"$here/8\" sub/\n '\n \n-test_expect_success '#9: GIT_WORK_TREE reluctantly accepted with gitfile' '\n+test_expect_success '#9: GIT_WORK_TREE accepted with gitfile' '\n \tmkdir -p 9/wt &&\n \ttry_repo 9 wt unset unset gitfile unset \\\n \t\t\"$here/9.git\" \"$here/9/wt\" \"$here/9\" \"(null)\" \\\n \t\t\"$here/9.git\" \"$here/9/sub/wt\" \"$here/9/sub\" \"(null)\" 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n test_expect_success '#10: GIT_DIR can point to gitfile' '\n@@ -391,19 +394,19 @@ test_expect_success '#11: setup' '\n '\n run_wt_tests 11 gitfile\n \n-test_expect_success '#12: core.worktree with gitfile is reluctantly accepted' '\n+test_expect_success '#12: core.worktree with gitfile is accepted' '\n \ttry_repo 12 unset unset \"$here/12\" gitfile unset \\\n \t\t\"$here/12.git\" \"$here/12\" \"$here/12\" \"(null)\" \\\n \t\t\"$here/12.git\" \"$here/12\" \"$here/12\" sub/ 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n-test_expect_success '#13: core.worktree+GIT_WORK_TREE relucantly accepted (with gitfile)' '\n+test_expect_success '#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)' '\n \t# or: you cannot intimidate away the lack of GIT_DIR setting\n \ttry_repo 13 non-existent-too unset non-existent gitfile unset \\\n \t\t\"$here/13.git\" \"$here/13/non-existent-too\" \"$here/13\" \"(null)\" \\\n \t\t\"$here/13.git\" \"$here/13/sub/non-existent-too\" \"$here/13/sub\" \"(null)\" 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n # case #14.\n@@ -514,7 +517,7 @@ test_expect_success '#16c: bare .git has no worktree' '\n \t\t\"$here/16c/.git\" \"(null)\" \"$here/16c/sub\" \"(null)\"\n '\n \n-test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is reluctantly accepted (bare case)' '\n+test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is accepted (bare case)' '\n \t# Just like #16.\n \tsetup_repo 17a unset \"\" true &&\n \tsetup_repo 17b unset \"\" true &&\n@@ -539,7 +542,7 @@ test_expect_success '#17: GIT_WORK_TREE without explicit GIT_DIR is reluctantly\n \ttry_repo 17c \"$here/17c\" unset unset \"\" true \\\n \t\t.git \"$here/17c\" \"$here/17c\" \"(null)\" \\\n \t\t\"$here/17c/.git\" \"$here/17c\" \"$here/17c\" sub/ 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n test_expect_success '#18: bare .git named by GIT_DIR has no worktree' '\n@@ -558,7 +561,7 @@ test_expect_success '#19: setup' '\n '\n run_wt_tests 19\n \n-test_expect_success '#20a: core.worktree without GIT_DIR reluctantly accepted (inside .git)' '\n+test_expect_success '#20a: core.worktree without GIT_DIR accepted (inside .git)' '\n \t# Unlike case #16a.\n \tsetup_repo 20a \"$here/20a\" \"\" unset &&\n \tmkdir -p 20a/.git/wt/sub &&\n@@ -568,7 +571,7 @@ test_expect_success '#20a: core.worktree without GIT_DIR reluctantly accepted (i\n \t\t\"$here/20a/.git\" \"$here/20a\" \"$here/20a\" .git/wt/ &&\n \ttry_case 20a/.git/wt/sub unset unset \\\n \t\t\"$here/20a/.git\" \"$here/20a\" \"$here/20a\" .git/wt/sub/ &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n test_expect_success '#20b/c: core.worktree and core.bare conflict' '\n@@ -581,7 +584,7 @@ test_expect_success '#20b/c: core.worktree and core.bare conflict' '\n \tgrep \"core.bare and core.worktree\" message\n '\n \n-# Case #21: core.worktree/GIT_WORK_TREE reluctantly overrides core.bare' '\n+# Case #21: core.worktree/GIT_WORK_TREE overrides core.bare' '\n test_expect_success '#21: setup, core.worktree warns before overriding core.bare' '\n \tsetup_repo 21 non-existent \"\" unset &&\n \tmkdir -p 21/.git/wt/sub &&\n@@ -591,7 +594,7 @@ test_expect_success '#21: setup, core.worktree warns before overriding core.bare\n \t\texport GIT_WORK_TREE &&\n \t\tgit symbolic-ref HEAD >/dev/null\n \t) 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n \n '\n run_wt_tests 21\n@@ -703,11 +706,11 @@ test_expect_success '#24: bare repo has no worktree (gitfile case)' '\n \t\t\"$here/24.git\" \"(null)\" \"$here/24/sub\" \"(null)\"\n '\n \n-test_expect_success '#25: GIT_WORK_TREE accepted reluctantly if GIT_DIR unset (bare gitfile case)' '\n+test_expect_success '#25: GIT_WORK_TREE accepted if GIT_DIR unset (bare gitfile case)' '\n \ttry_repo 25 \"$here/25\" unset unset gitfile true \\\n \t\t\"$here/25.git\" \"$here/25\" \"$here/25\" \"(null)\"  \\\n \t\t\"$here/25.git\" \"$here/25\" \"$here/25\" \"sub/\" 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n \n test_expect_success '#26: bare repo has no worktree (GIT_DIR -> gitfile case)' '\n@@ -732,11 +735,11 @@ test_expect_success '#28: core.worktree and core.bare conflict (gitfile case)' '\n \t\tcd 28 &&\n \t\ttest_must_fail git symbolic-ref HEAD\n \t) 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message &&\n+\t! grep \"^warning:\" message &&\n \tgrep \"core.bare and core.worktree\" message\n '\n \n-# Case #29: GIT_WORK_TREE(+core.worktree) reluctantly overries core.bare (gitfile case).\n+# Case #29: GIT_WORK_TREE(+core.worktree) overries core.bare (gitfile case).\n test_expect_success '#29: setup' '\n \tsetup_repo 29 non-existent gitfile true &&\n \tmkdir -p 29/sub/sub 29/wt/sub\n@@ -746,7 +749,7 @@ test_expect_success '#29: setup' '\n \t\texport GIT_WORK_TREE &&\n \t\tgit symbolic-ref HEAD >/dev/null\n \t) 2>message &&\n-\tgrep \"warning:.*GIT_DIR.*GIT_WORK_TREE\" message\n+\t! test -s message\n '\n run_wt_tests 29 gitfile\n \n"},{"id":"159775","messageId":"20110121220532.GA23695@burratino","threadId":"25845","inReplyTo":"7vtyh1oqy8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-21T22:05:33Z","receivedAt":"2011-01-21T22:05:33Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> Perhaps squash this into, or apply on top of, your 3/3?\n\nLooks good to me.  I'd suggest squashing and using your commit\nmessage for the combined commit.\n"},{"id":"159777","messageId":"7vpqrpoo7v.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"20110121220532.GA23695@burratino","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-21T23:01:56Z","receivedAt":"2011-01-21T23:01:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>\n>> Perhaps squash this into, or apply on top of, your 3/3?\n>\n> Looks good to me.  I'd suggest squashing and using your commit\n> message for the combined commit.\n\nThanks, will do.\n"},{"id":"159786","messageId":"AANLkTim_o9GGWbDFkeGb-va+4dP+StQE6GJyLpSMmV1H@mail.gmail.com","threadId":"25845","inReplyTo":"7v39omotxg.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-01-22T10:30:51Z","receivedAt":"2011-01-22T10:30:51Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Jan 22, 2011 at 3:58 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> I was re-reading this thread, and changed my mind; I think we should have\n> this series to avoid unnecessary regression, with or without clarifying\n> (5), before 1.7.4 final.\n\nSorry for late response. If we no longer consider this work-around,\nperhaps git.txt and config.txt should be updated to reflect it?\n-- \nDuy\n"},{"id":"159805","messageId":"7vipxfmb9u.fsf@alter.siamese.dyndns.org","threadId":"25845","inReplyTo":"AANLkTim_o9GGWbDFkeGb-va+4dP+StQE6GJyLpSMmV1H@mail.gmail.com","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-23T23:49:01Z","receivedAt":"2011-01-23T23:49:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> On Sat, Jan 22, 2011 at 3:58 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> I was re-reading this thread, and changed my mind; I think we should have\n>> this series to avoid unnecessary regression, with or without clarifying\n>> (5), before 1.7.4 final.\n>\n> Sorry for late response. If we no longer consider this work-around,\n> perhaps git.txt and config.txt should be updated to reflect it?\n\nI am Ok with us considering this as a \"work-around\"; as long as we keep it\nalive, the label does not matter much.\n\nAnd the necessity of documentation updates you raised is really a good\npoint.  Something like this (on top of jn/setup-fixes branch queued in\nnext)?\n\n\n Documentation/config.txt |   23 ++++++++++++++++-------\n Documentation/git.txt    |   13 ++++---------\n 2 files changed, 20 insertions(+), 16 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex ff7c225..72b74c4 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -317,17 +317,26 @@ false), while all other repositories are assumed to be bare (bare\n = true).\n \n core.worktree::\n-\tSet the path to the working tree.  The value will not be\n-\tused in combination with repositories found automatically in\n-\ta .git directory (i.e. $GIT_DIR is not set).\n+\tSet the path to the root of the work tree.\n \tThis can be overridden by the GIT_WORK_TREE environment\n \tvariable and the '--work-tree' command line option. It can be\n-\tan absolute path or relative path to the directory specified by\n-\t--git-dir or GIT_DIR.\n-\tNote: If --git-dir or GIT_DIR are specified but none of\n+\tan absolute path or a relative path to the .git directory,\n+\teither specified by --git-dir or GIT_DIR, or automatically\n+\tdiscovered.\n+\tIf --git-dir or GIT_DIR are specified but none of\n \t--work-tree, GIT_WORK_TREE and core.worktree is specified,\n-\tthe current working directory is regarded as the top directory\n+\tthe current working directory is regarded as the top level\n \tof your working tree.\n++\n+Note that this variable is honored even when set in a configuration\n+file in a \".git\" subdirectory of a directory, and its value differs\n+from the latter directory (e.g. \"/path/to/.git/config\" has\n+core.worktree set to \"/different/path\"), which is most likely a\n+misconfiguration.  Running git commands in \"/path/to\" directory will\n+still use \"/different/path\" as the root of the work tree and can cause\n+confusion, unless you know what you are doing (e.g. you are creating a\n+read-only snapshot of the same index to a location different from the\n+repository's usual working tree).\n \n core.logAllRefUpdates::\n \tEnable the reflog. Updates to a ref <ref> is logged to the file\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 4e5fe4d..245d84f 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -291,17 +291,12 @@ help ...`.\n \tpath or relative path to current working directory.\n \n --work-tree=<path>::\n-\tSet the path to the working tree.  The value will not be\n-\tused in combination with repositories found automatically in\n-\ta .git directory (i.e. $GIT_DIR is not set).\n+\tSet the path to the working tree. It can be an absolute path\n+\tor relative path to the current working directory.\n \tThis can also be controlled by setting the GIT_WORK_TREE\n \tenvironment variable and the core.worktree configuration\n-\tvariable. It can be an absolute path or relative path to\n-\tcurrent working directory.\n-\tNote: If --git-dir or GIT_DIR are specified but none of\n-\t--work-tree, GIT_WORK_TREE and core.worktree is specified,\n-\tthe current working directory is regarded as the top directory\n-\tof your working tree.\n+\tvariable (see core.worktree in linkgit:git-config[1] for a\n+\tmore detailed discussion).\n \n --bare::\n \tTreat the repository as a bare repository.  If GIT_DIR\n"},{"id":"159812","messageId":"20110124084552.GA17348@burratino","threadId":"25845","inReplyTo":"7vipxfmb9u.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] setup: always honor GIT_WORK_TREE and core.worktree","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-24T08:45:53Z","receivedAt":"2011-01-24T08:45:53Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> Something like this (on top of jn/setup-fixes branch queued in\n> next)?\n\nFor what it's worth,\n Acked-by: Jonathan Nieder <jrnieder@gmail.com>\n\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -317,17 +317,26 @@ false), while all other repositories are assumed to be bare (bare\n>  = true).\n>  \n>  core.worktree::\n> -\tSet the path to the working tree.  The value will not be\n> -\tused in combination with repositories found automatically in\n> -\ta .git directory (i.e. $GIT_DIR is not set).\n> +\tSet the path to the root of the work tree.\n\nMost manpages seem to stick to the phrase \"working tree\".  Not sure\nif that's worth worrying about --- maybe it would be good to allow or\nencourage usage to drift to the term \"work tree\" that gets used in\nmany parts of the interface.\n\n>  \tThis can be overridden by the GIT_WORK_TREE environment\n>  \tvariable and the '--work-tree' command line option. It can be\n> +\tan absolute path or a relative path to the .git directory,\n> +\teither specified by --git-dir or GIT_DIR, or automatically\n> +\tdiscovered.\n\nMaybe:\n\n\tThe value can be an absolute path or relative to the path to\n\tthe .git directory, which is either specified by --git-dir or\n\tGIT_DIR or automatically discovered.\n\n> -\tan absolute path or relative path to the directory specified by\n> -\t--git-dir or GIT_DIR.\n> -\tNote: If --git-dir or GIT_DIR are specified but none of\n> +\tIf --git-dir or GIT_DIR are specified but none of\n>  \t--work-tree, GIT_WORK_TREE and core.worktree is specified,\n> -\tthe current working directory is regarded as the top directory\n> +\tthe current working directory is regarded as the top level\n>  \tof your working tree.\n\nSubject-verb agreement: \"--git-dir or GIT_DIR is specified\" (s/are/is/)\n\n> ++\n> +Note that this variable is honored even when set in a configuration\n> +file in a \".git\" subdirectory of a directory, and its value differs\n> +from the latter directory (e.g. \"/path/to/.git/config\" has\n> +core.worktree set to \"/different/path\"), which is most likely a\n> +misconfiguration.\n\nI think it's clearer without the comma between \"directory\" and \"and\"\n(otherwise, it's too easy to parse as\n\n\tNote that this variable is honored even when set ....\n\tIts value differs from the latter directory, which is most\n\tlikely a misconfiguration.\n\n).\n\n> +                   Running git commands in \"/path/to\" directory will\n> +still use \"/different/path\" as the root of the work tree and can cause\n> +confusion, unless you know what you are doing (e.g. you are creating a\n> +read-only snapshot of the same index to a location different from the\n> +repository's usual working tree).\n\nMissing article: s,in \"path/to\" directory,in the \"/path/to\" directory,\n\nComma usage: s/confusion, unless/confusion unless/ to avoid misparsing\nthis as meaning \"will use this work tree unless you know what you are\ndoing\".\n\n> --- a/Documentation/git.txt\n> +++ b/Documentation/git.txt\n> @@ -291,17 +291,12 @@ help ...`.\n>  \tpath or relative path to current working directory.\n>  \n>  --work-tree=<path>::\n> -\tSet the path to the working tree.  The value will not be\n> -\tused in combination with repositories found automatically in\n> -\ta .git directory (i.e. $GIT_DIR is not set).\n> +\tSet the path to the working tree. It can be an absolute path\n> +\tor relative path to the current working directory.\n\ns/relative path to/path relative to/\n\n>  \tThis can also be controlled by setting the GIT_WORK_TREE\n>  \tenvironment variable and the core.worktree configuration\n> +\tvariable (see core.worktree in linkgit:git-config[1] for a\n> +\tmore detailed discussion).\n> -\tvariable. It can be an absolute path or relative path to\n[...]\n\nNice.\n"},{"id":"159861","messageId":"20110126004915.GA11230@burratino","threadId":"25845","inReplyTo":"1290785563-15339-2-git-send-email-pclouds@gmail.com","subject":"[PATCH/RFC 0/3] trace: omit noisy repository discovery report","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-26T00:49:15Z","receivedAt":"2011-01-26T00:49:15Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Nguyễn Thái Ngọc Duy wrote:\n\n> +++ b/trace.c\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\nA few days ago I was tracing something or other and decided that these\nextra lines are annoying.\n\nPatch 1 moves this code from trace.c to git.c, to contain its impact\nto a single translation unit (that is, it let me experiment without\ntouching cache.h after that).\n\nPatch 2 removes the repo-setup tracing code, introducing a\ntest-repo-setup helper to take its place in the repo setup tests.\n\nPatch 3 does some cleaning up made possible by patch 2.\n\nThoughts?\nJonathan Nieder (3):\n  setup: do not expose tracing code\n  setup: move debugging code to test-repo-setup helper\n  setup: stop using GIT_TRACE in tests\n\n .gitignore            |    1 +\n Makefile              |    1 +\n cache.h               |    1 -\n git.c                 |    4 ----\n t/t1510-repo-setup.sh |   12 +++++-------\n test-repo-setup.c     |   32 ++++++++++++++++++++++++++++++++\n trace.c               |   49 -------------------------------------------------\n 7 files changed, 39 insertions(+), 61 deletions(-)\n create mode 100644 test-repo-setup.c\n\n-- \n1.7.4.rc3\n"},{"id":"159862","messageId":"20110126005530.GB11230@burratino","threadId":"25845","inReplyTo":"20110126004915.GA11230@burratino","subject":"[PATCH 1/3] setup: do not expose tracing code","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-26T00:55:30Z","receivedAt":"2011-01-26T00:55:30Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"The trace_repo_setup function has only one caller (run_builtin)\nwhich lives in git.c.  Move the code there and stop advertising\nit in cache.h.\n\nThis means it is likely to remain safe to use startup_info within\ntrace_repo_setup, since the trace_repo_setup function is only used\nwhen running builtins.  Do so and drop the \"prefix\" parameter.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n cache.h |    1 -\n git.c   |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-\n trace.c |   49 -------------------------------------------------\n 3 files changed, 50 insertions(+), 51 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex d83d68c..2eb3ccc 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1067,7 +1067,6 @@ __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 68334f6..d1b15f1 100644\n--- a/git.c\n+++ b/git.c\n@@ -238,6 +238,55 @@ static int handle_alias(int *argcp, const char ***argv)\n \treturn ret;\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+static void trace_repo_setup(void)\n+{\n+\tconst char *git_work_tree;\n+\tconst char *prefix = startup_info->prefix;\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+\tif (!(git_work_tree = get_git_work_tree()))\n+\t\tgit_work_tree = \"(null)\";\n+\n+\tif (!prefix)\n+\t\tprefix = \"(null)\";\n+\n+\ttrace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n+\ttrace_printf(\"setup: worktree: %s\\n\", quote_crnl(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+\n const char git_version_string[] = GIT_VERSION;\n \n #define RUN_SETUP\t\t(1<<0)\n@@ -278,7 +327,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)\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\t\ttrace_repo_setup();\n \t}\n \tcommit_pager_choice();\n \ndiff --git a/trace.c b/trace.c\nindex 35d388d..0fb2a2c 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -127,52 +127,3 @@ 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-\tconst char *git_work_tree;\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-\tif (!(git_work_tree = get_git_work_tree()))\n-\t\tgit_work_tree = \"(null)\";\n-\n-\tif (!prefix)\n-\t\tprefix = \"(null)\";\n-\n-\ttrace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n-\ttrace_printf(\"setup: worktree: %s\\n\", quote_crnl(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.4.rc3\n"},{"id":"159864","messageId":"20110126005916.GC11230@burratino","threadId":"25845","inReplyTo":"20110126004915.GA11230@burratino","subject":"[PATCH 2/3] trace: omit repository discovery report","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-26T00:59:16Z","receivedAt":"2011-01-26T00:59:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"The run-command library advertises what process it is running through\nthe GIT_TRACE stream (see 575ba9d6, 2006-06-25) to provide context\nduring debugging for error messages that might come from the child\nprocess.  In the same spirit, since v1.7.4-rc0~4^2~46 (builtins: print\nsetup info if repo is found, 2010-11-26) the repo-setup library prints\nits result to GIT_TRACE, so the cwd, location of the git directory,\nand so on are readily available during debug.\n\nIn practice, four extra lines of trace output per git process is too\nmuch noise.  So stop printing repository discovery info except when\nrunning tests.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n .gitignore            |    1 +\n Makefile              |    1 +\n git.c                 |   53 -------------------------------------------\n t/t1510-repo-setup.sh |    2 +-\n test-repo-setup.c     |   60 +++++++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 63 insertions(+), 54 deletions(-)\n create mode 100644 test-repo-setup.c\n\ndiff --git a/.gitignore b/.gitignore\nindex 3dd6ef7..e1fc557 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -173,6 +173,7 @@\n /test-obj-pool\n /test-parse-options\n /test-path-utils\n+/test-repo-setup\n /test-run-command\n /test-sha1\n /test-sigchain\ndiff --git a/Makefile b/Makefile\nindex 775ee83..01cc5c0 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -427,6 +427,7 @@ TEST_PROGRAMS_NEED_X += test-match-trees\n TEST_PROGRAMS_NEED_X += test-obj-pool\n TEST_PROGRAMS_NEED_X += test-parse-options\n TEST_PROGRAMS_NEED_X += test-path-utils\n+TEST_PROGRAMS_NEED_X += test-repo-setup\n TEST_PROGRAMS_NEED_X += test-run-command\n TEST_PROGRAMS_NEED_X += test-sha1\n TEST_PROGRAMS_NEED_X += test-sigchain\ndiff --git a/git.c b/git.c\nindex d1b15f1..d532576 100644\n--- a/git.c\n+++ b/git.c\n@@ -238,55 +238,6 @@ static int handle_alias(int *argcp, const char ***argv)\n \treturn ret;\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-static void trace_repo_setup(void)\n-{\n-\tconst char *git_work_tree;\n-\tconst char *prefix = startup_info->prefix;\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-\tif (!(git_work_tree = get_git_work_tree()))\n-\t\tgit_work_tree = \"(null)\";\n-\n-\tif (!prefix)\n-\t\tprefix = \"(null)\";\n-\n-\ttrace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n-\ttrace_printf(\"setup: worktree: %s\\n\", quote_crnl(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-\n const char git_version_string[] = GIT_VERSION;\n \n #define RUN_SETUP\t\t(1<<0)\n@@ -324,10 +275,6 @@ 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();\n \t}\n \tcommit_pager_choice();\n \ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex 15101d5..c2edf6f 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -57,7 +57,7 @@ test_repo () {\n \t\t\texport GIT_WORK_TREE\n \t\tfi &&\n \t\trm -f trace &&\n-\t\tGIT_TRACE=\"$(pwd)/trace\" git symbolic-ref HEAD >/dev/null &&\n+\t\tGIT_TRACE=\"$(pwd)/trace\" test-repo-setup &&\n \t\tgrep '^setup: ' trace >result &&\n \t\ttest_cmp expected result\n \t)\ndiff --git a/test-repo-setup.c b/test-repo-setup.c\nnew file mode 100644\nindex 0000000..3b66237\n--- /dev/null\n+++ b/test-repo-setup.c\n@@ -0,0 +1,60 @@\n+#include \"cache.h\"\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+static void trace_repo_setup(void)\n+{\n+\tconst char *git_work_tree;\n+\tconst char *prefix = startup_info->prefix;\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+\tif (!(git_work_tree = get_git_work_tree()))\n+\t\tgit_work_tree = \"(null)\";\n+\n+\tif (!prefix)\n+\t\tprefix = \"(null)\";\n+\n+\ttrace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n+\ttrace_printf(\"setup: worktree: %s\\n\", quote_crnl(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+\n+int main(int argc, char **argv)\n+{\n+\tstatic struct startup_info test_startup_info;\n+\n+\tstartup_info = &test_startup_info;\n+\tsetup_git_directory();\n+\ttrace_repo_setup();\n+\treturn 0;\n+}\n-- \n1.7.4.rc3\n"},{"id":"159865","messageId":"20110126010147.GD11230@burratino","threadId":"25845","inReplyTo":"20110126004915.GA11230@burratino","subject":"[PATCH 3/3] tests: avoid unnecessary use of GIT_TRACE in repo-setup tests","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-26T01:01:47Z","receivedAt":"2011-01-26T01:01:47Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Now that the startup info is printed by a separate helper, there\nis no need to mark that output with \"setup: \" or use an environment\nvariable to request it.\n\nWhile we're changing the test-repo-setup output format, stop quoting\nnewlines to give the tests a chance of passing when $TEST_DIRECTORY\ncontains a newline or backslash.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nThanks for reading.\n\n t/t1510-repo-setup.sh |   12 +++++-------\n test-repo-setup.c     |   40 ++++++----------------------------------\n 2 files changed, 11 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh\nindex c2edf6f..a8cb445 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -56,9 +56,7 @@ test_repo () {\n \t\t\tGIT_WORK_TREE=\"$3\" &&\n \t\t\texport GIT_WORK_TREE\n \t\tfi &&\n-\t\trm -f trace &&\n-\t\tGIT_TRACE=\"$(pwd)/trace\" test-repo-setup &&\n-\t\tgrep '^setup: ' trace >result &&\n+\t\ttest-repo-setup >result &&\n \t\ttest_cmp expected result\n \t)\n }\n@@ -105,10 +103,10 @@ setup_env () {\n \n expect () {\n \tcat >\"$1/expected\" <<-EOF\n-\tsetup: git_dir: $2\n-\tsetup: worktree: $3\n-\tsetup: cwd: $4\n-\tsetup: prefix: $5\n+\tgit_dir: $2\n+\tworktree: $3\n+\tcwd: $4\n+\tprefix: $5\n \tEOF\n }\n \ndiff --git a/test-repo-setup.c b/test-repo-setup.c\nindex 3b66237..72d35fe 100644\n--- a/test-repo-setup.c\n+++ b/test-repo-setup.c\n@@ -1,52 +1,24 @@\n #include \"cache.h\"\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 static void trace_repo_setup(void)\n {\n-\tconst char *git_work_tree;\n+\tconst char *git_work_tree = get_git_work_tree();\n \tconst char *prefix = startup_info->prefix;\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-\tif (!(git_work_tree = get_git_work_tree()))\n+\tif (!git_work_tree)\n \t\tgit_work_tree = \"(null)\";\n \n \tif (!prefix)\n \t\tprefix = \"(null)\";\n \n-\ttrace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n-\ttrace_printf(\"setup: worktree: %s\\n\", quote_crnl(git_work_tree));\n-\ttrace_printf(\"setup: cwd: %s\\n\", quote_crnl(cwd));\n-\ttrace_printf(\"setup: prefix: %s\\n\", quote_crnl(prefix));\n+\tprintf(\"git_dir: %s\\n\", get_git_dir());\n+\tprintf(\"worktree: %s\\n\", git_work_tree);\n+\tprintf(\"cwd: %s\\n\", cwd);\n+\tprintf(\"prefix: %s\\n\", prefix);\n }\n \n int main(int argc, char **argv)\n-- \n1.7.4.rc3\n"},{"id":"159866","messageId":"AANLkTinyVKQOVHgdVhB3PhQOp9FbdNNHLqYny6i=_qKw@mail.gmail.com","threadId":"25845","inReplyTo":"20110126005916.GC11230@burratino","subject":"Re: [PATCH 2/3] trace: omit repository discovery report","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-01-26T01:19:21Z","receivedAt":"2011-01-26T01:19:21Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n2011/1/26 Jonathan Nieder <jrnieder@gmail.com>:\n> In practice, four extra lines of trace output per git process is too\n> much noise.  So stop printing repository discovery info except when\n> running tests.\n\nDoesn't this disable _all_ discovery debugging aids? So doesn't this\nmake it more difficult to figure out what's going on in the\nnot-many-child case?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"159867","messageId":"AANLkTimB0rJPLkwyrQEibngeRjgHLxhrntG5sMdQ9CW0@mail.gmail.com","threadId":"25845","inReplyTo":"20110126004915.GA11230@burratino","subject":"Re: [PATCH/RFC 0/3] trace: omit noisy repository discovery report","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-01-26T01:45:12Z","receivedAt":"2011-01-26T01:45:12Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/1/26 Jonathan Nieder <jrnieder@gmail.com>:\n> Nguyễn Thái Ngọc Duy wrote:\n>\n>> +++ b/trace.c\n> [...]\n>> +     trace_printf(\"setup: git_dir: %s\\n\", quote_crnl(get_git_dir()));\n>> +     trace_printf(\"setup: worktree: %s\\n\", quote_crnl(get_git_work_tree()));\n>> +     trace_printf(\"setup: cwd: %s\\n\", quote_crnl(cwd));\n>> +     trace_printf(\"setup: prefix: %s\\n\", quote_crnl(prefix));\n>> +}\n>\n> A few days ago I was tracing something or other and decided that these\n> extra lines are annoying.\n>\n> Patch 1 moves this code from trace.c to git.c, to contain its impact\n> to a single translation unit (that is, it let me experiment without\n> touching cache.h after that).\n>\n> Patch 2 removes the repo-setup tracing code, introducing a\n> test-repo-setup helper to take its place in the repo setup tests.\n>\n> Patch 3 does some cleaning up made possible by patch 2.\n>\n> Thoughts?\n\nI'm fine with this. Although long term maybe we should support pattern\nmatching or category selection in GIT_TRACE.\n-- \nDuy\n"},{"id":"159868","messageId":"20110126014638.GA29929@burratino","threadId":"25845","inReplyTo":"AANLkTinyVKQOVHgdVhB3PhQOp9FbdNNHLqYny6i=_qKw@mail.gmail.com","subject":"Re: [PATCH 2/3] trace: omit repository discovery report","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-26T01:46:38Z","receivedAt":"2011-01-26T01:46:38Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sverre Rabbelier wrote:\n> 2011/1/26 Jonathan Nieder <jrnieder@gmail.com>:\n\n>> In practice, four extra lines of trace output per git process is too\n>> much noise.  So stop printing repository discovery info except when\n>> running tests.\n>\n> Doesn't this disable _all_ discovery debugging aids? So doesn't this\n> make it more difficult to figure out what's going on in the\n> not-many-child case?\n\nLet's take the 0-child case.  With v1.7.4-rc3:\n\n $ GIT_TRACE=1; export GIT_TRACE\n $ git symbolic-ref confused\n setup: git_dir: .git\n setup: worktree: /home/jrn/src/git\n setup: cwd: /home/jrn/src/git\n setup: prefix: (null)\n trace: built-in: git 'symbolic-ref' 'confused'\n fatal: ref confused is not a symbolic ref\n\n $ git rev-parse confused >/dev/null\n trace: built-in: git 'rev-parse' 'confused'\n fatal: ambiguous argument 'confused': unknown revision or path not in the working tree.\n Use '--' to separate paths from revisions\n\nObservations:\n\n- Orthogonal to the useful quantity of information is that it would be\n  nice if the setup info dump were consistent.  Currently non-builtins\n  and commands like rev-parse without RUN_SETUP|RUN_SETUP_GENTLY skip\n  it.\n\n- Except for \"cwd\", the setup lines write information that is easy to\n  retrieve with git rev-parse.  In my limited experience, it is not\n  the information I need when debugging.\n\n- The cwd, on the other hand, could be very useful.  Maybe git should\n  make sense to always follow \"trace: run_command\", \"trace: exec\", and\n  \"trace: built-in\" lines with \"trace: cwd\".\n"},{"id":"159869","messageId":"AANLkTimrRSkbzULnaQhrhA2LQSgEPH95cWFbJGsAmvC6@mail.gmail.com","threadId":"25845","inReplyTo":"20110126005916.GC11230@burratino","subject":"Re: [PATCH 2/3] trace: omit repository discovery report","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2011-01-26T01:53:11Z","receivedAt":"2011-01-26T01:53:11Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2011/1/26 Jonathan Nieder <jrnieder@gmail.com>:\n> +int main(int argc, char **argv)\n> +{\n> +       static struct startup_info test_startup_info;\n> +\n> +       startup_info = &test_startup_info;\n> +       setup_git_directory();\n\nI think you should do _gently() here (in future maybe, because t1510\ndoes not use it yet).\nNote to self, support for testing setup_work_tree() behavior.\n-- \nDuy\n"},{"id":"159872","messageId":"20110126050715.GA2665@sigill.intra.peff.net","threadId":"25845","inReplyTo":"AANLkTimB0rJPLkwyrQEibngeRjgHLxhrntG5sMdQ9CW0@mail.gmail.com","subject":"Re: [PATCH/RFC 0/3] trace: omit noisy repository discovery report","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-01-26T05:07:15Z","receivedAt":"2011-01-26T05:07:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 26, 2011 at 08:45:12AM +0700, Nguyen Thai Ngoc Duy wrote:\n\n> > A few days ago I was tracing something or other and decided that these\n> > extra lines are annoying.\n> >\n> > Patch 1 moves this code from trace.c to git.c, to contain its impact\n> > to a single translation unit (that is, it let me experiment without\n> > touching cache.h after that).\n> >\n> > Patch 2 removes the repo-setup tracing code, introducing a\n> > test-repo-setup helper to take its place in the repo setup tests.\n> >\n> > Patch 3 does some cleaning up made possible by patch 2.\n> >\n> > Thoughts?\n> \n> I'm fine with this. Although long term maybe we should support pattern\n> matching or category selection in GIT_TRACE.\n\nYeah. I recently was peeking at the git protocol, and I wrote some\nnice-ish packet-tracing support. I triggered it via:\n\n  GIT_TRACE=$whatever GIT_TRACE_PACKET=1 git push ...\n\nSo you have to turn on tracing (to whatever destination you want) and\nthen turn on packet tracing with a bool. In retrospect, probably\nGIT_TRACE_* should take the same type of location parameter as\nGIT_TRACE, so you can get whatever subset of trace going to wherever you\nlike. And then the repo setup code can just go into GIT_TRACE_SETUP or\nsomething.\n\n-Peff\n"}]}