{"thread":{"id":"25712","subject":"[PATCH 0/7] nd/setup fixups","startedAt":"2010-11-11T14:20:41Z","lastAt":"2010-11-11T14:20:48Z","messageCount":8,"participants":["Nguyễn Thái Ngọc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"155691","messageId":"1289485248-8966-1-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":null,"subject":"[PATCH 0/7] nd/setup fixups","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:41Z","receivedAt":"2010-11-11T14:20:41Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This replaces the last three patches in nd/setup in pu (from clean up\nsetup_discovered_git_dir to t1020-subdirectory)\n\nChanges are:\n\n - Retain old behavior of setup_discovered_git_dir() when .git is not\n   explicitly set by set_git_dir(), but later on by setup_git_env().\n   This helps remove the ugly workaround in set_git_dir() earlier.\n\n - Include t0001 tests from Jonathan. You'll see I sneak more patches\n   in from my old nd/setup from time to time, until I push all of them :)\n\n - set_git_work_tree() now allows multiple calls as long as the new\n   worktree and the old one is the same, as Junio suggested.\n\n - Document update. Turns out not much is needed.\n\nJonathan Nieder (1):\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 (5):\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.txt    |    2 +-\n builtin/init-db.c        |   14 ++-\n cache.h                  |    1 -\n environment.c            |   32 ++----\n setup.c                  |  208 +++++++++++++++++--------------\n t/t0001-init.sh          |   56 +++++++++\n t/t1020-subdirectory.sh  |    8 ++\n t/t1510-repo-setup.sh    |  310 +++++++++++++++++++++++-----------------------\n 9 files changed, 360 insertions(+), 294 deletions(-)\n\n-- \n1.7.3.2.210.g045198\n"},{"id":"155692","messageId":"1289485248-8966-2-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 1/7] t1020-subdirectory: test alias expansion in a subdirectory","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:42Z","receivedAt":"2010-11-11T14:20:42Z","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>\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.210.g045198\n"},{"id":"155693","messageId":"1289485248-8966-3-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 2/7] setup: clean up setup_discovered_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:43Z","receivedAt":"2010-11-11T14:20:43Z","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>\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 629ba34..d492996 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -2343,7 +2343,7 @@ EOF\n \ttest_repo 16\n '\n \n-test_expect_failure '#16.2: in subdir' '\n+test_expect_success '#16.2: in subdir' '\n \tcat >16/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/16/.git\n setup: worktree: (null)\n@@ -2471,7 +2471,7 @@ EOF\n \ttest_repo 17\n '\n \n-test_expect_failure '#17.2: in subdir' '\n+test_expect_success '#17.2: in subdir' '\n \tcat >17/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/17/.git\n setup: worktree: (null)\n@@ -2936,7 +2936,7 @@ EOF\n \ttest_repo 20\n '\n \n-test_expect_failure '#20.2: in subdir' '\n+test_expect_success '#20.2: in subdir' '\n \tcat >20/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/20/.git\n setup: worktree: (null)\n@@ -3065,7 +3065,7 @@ EOF\n \ttest_repo 21\n '\n \n-test_expect_failure '#21.2: in subdir' '\n+test_expect_success '#21.2: in subdir' '\n \tcat >21/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/21/.git\n setup: worktree: (null)\n@@ -3703,7 +3703,7 @@ test_expect_success '#24: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#24: at root' '\n+test_expect_success '#24: at root' '\n \tcat >24/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/24.git\n setup: worktree: (null)\n@@ -3713,7 +3713,7 @@ EOF\n \ttest_repo 24\n '\n \n-test_expect_failure '#24: in subdir' '\n+test_expect_success '#24: in subdir' '\n \tcat >24/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/24.git\n setup: worktree: (null)\n@@ -3752,7 +3752,7 @@ test_expect_success '#25: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#25: at root' '\n+test_expect_success '#25: at root' '\n \tcat >25/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/25.git\n setup: worktree: (null)\n@@ -3762,7 +3762,7 @@ EOF\n \ttest_repo 25\n '\n \n-test_expect_failure '#25: in subdir' '\n+test_expect_success '#25: in subdir' '\n \tcat >25/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/25.git\n setup: worktree: (null)\n@@ -4137,7 +4137,7 @@ test_expect_success '#28: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#28: at root' '\n+test_expect_success '#28: at root' '\n \tcat >28/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/28.git\n setup: worktree: (null)\n@@ -4147,7 +4147,7 @@ EOF\n \ttest_repo 28\n '\n \n-test_expect_failure '#28: in subdir' '\n+test_expect_success '#28: in subdir' '\n \tcat >28/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/28.git\n setup: worktree: (null)\n@@ -4186,7 +4186,7 @@ test_expect_success '#29: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#29: at root' '\n+test_expect_success '#29: at root' '\n \tcat >29/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/29.git\n setup: worktree: (null)\n@@ -4196,7 +4196,7 @@ EOF\n \ttest_repo 29\n '\n \n-test_expect_failure '#29: in subdir' '\n+test_expect_success '#29: in subdir' '\n \tcat >29/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/29.git\n setup: worktree: (null)\n-- \n1.7.3.2.210.g045198\n"},{"id":"155694","messageId":"1289485248-8966-4-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 3/7] setup: rework setup_explicit_git_dir()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:44Z","receivedAt":"2010-11-11T14:20:44Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This function is the most complex one among the three setup_*\nfunctions because all GIT_DIR, GIT_WORK_TREE, core.worktree and\ncore.bare are involved.\n\nBecause core.worktree is only effective inside\nsetup_explicit_git_dir() and the extra code in setup_git_directory()\nis to handle that. The extra code can now be retired.\n\nAlso note that setup_explicit assignment is removed, worktree setting\nis no longer decided by get_git_work_tree(). get_git_work_tree() will\nbe simplified in the next commit.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n setup.c               |  138 +++++++++++++----------\n t/t1510-repo-setup.sh |  286 ++++++++++++++++++++++++------------------------\n 2 files changed, 221 insertions(+), 203 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 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 d492996..0343045 100755\n--- a/t/t1510-repo-setup.sh\n+++ b/t/t1510-repo-setup.sh\n@@ -647,7 +647,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=.. in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=.. in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY/6\n@@ -658,7 +658,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY/6\n@@ -779,7 +779,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. at root' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. at root' '\n \tcat >6/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -790,7 +790,7 @@ EOF\n \tGIT_DIR=.git test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '\n \tcat >6/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -823,7 +823,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/6/.git\" test_repo 6\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -834,7 +834,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 6/sub/sub\n '\n \n-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '\n+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '\n \tcat >6/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/6/.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1254,7 +1254,7 @@ test_expect_success '#10: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#10: at root' '\n+test_expect_success '#10: at root' '\n \tcat >10/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10\n@@ -1264,7 +1264,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/10/.git\" test_repo 10\n '\n \n-test_expect_failure '#10: in subdir' '\n+test_expect_success '#10: in subdir' '\n \tcat >10/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10/sub\n@@ -1274,7 +1274,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/10/.git\" test_repo 10/sub\n '\n \n-test_expect_failure '#10: relative GIT_DIR at root' '\n+test_expect_success '#10: relative GIT_DIR at root' '\n \tcat >10/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10\n@@ -1284,7 +1284,7 @@ EOF\n \tGIT_DIR=.git test_repo 10\n '\n \n-test_expect_failure '#10: relative GIT_DIR in subdir' '\n+test_expect_success '#10: relative GIT_DIR in subdir' '\n \tcat >10/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/10.git\n setup: worktree: $TRASH_DIRECTORY/10/sub\n@@ -1321,7 +1321,7 @@ test_expect_success '#11: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1331,7 +1331,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1341,7 +1341,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1351,7 +1351,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1361,7 +1361,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=. test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1371,7 +1371,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1381,7 +1381,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >11/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1391,7 +1391,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11\" test_repo 11/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11\n@@ -1401,7 +1401,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=../.. test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1411,7 +1411,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1421,7 +1421,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1431,7 +1431,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=wt test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1441,7 +1441,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1451,7 +1451,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1461,7 +1461,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1471,7 +1471,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=../../wt test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY/11/wt\n@@ -1481,7 +1481,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/11/wt\" test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1491,7 +1491,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1501,7 +1501,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1511,7 +1511,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=.. test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >11/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1521,7 +1521,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1531,7 +1531,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1541,7 +1541,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1551,7 +1551,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/11/.git\" GIT_WORK_TREE=../../../ test_repo 11/sub/sub\n '\n \n-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >11/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/11.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1686,7 +1686,7 @@ test_expect_success '#14: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1697,7 +1697,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1708,7 +1708,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14 at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14 at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1719,7 +1719,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1730,7 +1730,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1741,7 +1741,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1752,7 +1752,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14 in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14 in subdir' '\n \tcat >14/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1763,7 +1763,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14\n@@ -1774,7 +1774,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1785,7 +1785,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1796,7 +1796,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1807,7 +1807,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1818,7 +1818,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1829,7 +1829,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1840,7 +1840,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1851,7 +1851,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY/14/wt\n@@ -1862,7 +1862,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1873,7 +1873,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1884,7 +1884,7 @@ EOF\n \tGIT_DIR=.git test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1895,7 +1895,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=.. at root' '\n+test_expect_success '#14: GIT_DIR, core.worktree=.. at root' '\n \tcat >14/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1906,7 +1906,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1917,7 +1917,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1928,7 +1928,7 @@ EOF\n \tGIT_DIR=../../.git test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1939,7 +1939,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/14/.git\" test_repo 14/sub/sub\n '\n \n-test_expect_failure '#14: GIT_DIR, core.worktree=.. in subdir' '\n+test_expect_success '#14: GIT_DIR, core.worktree=.. in subdir' '\n \tcat >14/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/14.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -1978,7 +1978,7 @@ test_expect_success '#15: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -1988,7 +1988,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -1998,7 +1998,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2008,7 +2008,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2018,7 +2018,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=. test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2028,7 +2028,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2038,7 +2038,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >15/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2048,7 +2048,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15\" test_repo 15/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15\n@@ -2058,7 +2058,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=../.. test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2068,7 +2068,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2078,7 +2078,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2088,7 +2088,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=wt test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2098,7 +2098,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2108,7 +2108,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2118,7 +2118,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2128,7 +2128,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=../../wt test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY/15/wt\n@@ -2138,7 +2138,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/15/wt\" test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2148,7 +2148,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2158,7 +2158,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2168,7 +2168,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=.. test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >15/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2178,7 +2178,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2188,7 +2188,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2198,7 +2198,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -2208,7 +2208,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/15/.git\" GIT_WORK_TREE=../../../ test_repo 15/sub/sub\n '\n \n-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >15/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/15.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -3151,7 +3151,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22/.git\n@@ -3162,7 +3162,7 @@ EOF\n \tGIT_DIR=.. test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22/.git\n@@ -3283,7 +3283,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '\n \tcat >22/.git/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3294,7 +3294,7 @@ EOF\n \tGIT_DIR=. test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '\n \tcat >22/.git/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3327,7 +3327,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/22/.git\" test_repo 22/.git\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3338,7 +3338,7 @@ EOF\n \tGIT_DIR=.. test_repo 22/.git/sub\n '\n \n-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '\n \tcat >22/.git/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/22/.git\n setup: worktree: $TRASH_DIRECTORY/22\n@@ -3392,7 +3392,7 @@ test_expect_success '#22.2: setup' '\n \tgit config --file=\"$TRASH_DIRECTORY/22/.git/config\" core.bare true\n '\n \n-test_expect_failure '#22.2: at .git' '\n+test_expect_success '#22.2: at .git' '\n \t(\n \tcd 22/.git &&\n \tGIT_DIR=. test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -3400,7 +3400,7 @@ test_expect_failure '#22.2: at .git' '\n \t)\n '\n \n-test_expect_failure '#22.2: at root' '\n+test_expect_success '#22.2: at root' '\n \t(\n \tcd 22 &&\n \tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -3800,7 +3800,7 @@ test_expect_success '#26: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#26: (rel) at root' '\n+test_expect_success '#26: (rel) at root' '\n \tcat >26/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3810,7 +3810,7 @@ EOF\n \t GIT_DIR=.git test_repo 26\n '\n \n-test_expect_failure '#26: at root' '\n+test_expect_success '#26: at root' '\n \tcat >26/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3820,7 +3820,7 @@ EOF\n \t GIT_DIR=\"$TRASH_DIRECTORY/26/.git\" test_repo 26\n '\n \n-test_expect_failure '#26: (rel) in subdir' '\n+test_expect_success '#26: (rel) in subdir' '\n \tcat >26/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3830,7 +3830,7 @@ EOF\n \tGIT_DIR=../.git test_repo 26/sub\n '\n \n-test_expect_failure '#26: in subdir' '\n+test_expect_success '#26: in subdir' '\n \tcat >26/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/26.git\n setup: worktree: (null)\n@@ -3868,7 +3868,7 @@ test_expect_success '#27: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3878,7 +3878,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3888,7 +3888,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3898,7 +3898,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3908,7 +3908,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3918,7 +3918,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3928,7 +3928,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >27/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3938,7 +3938,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27\" test_repo 27/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27\n@@ -3948,7 +3948,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3958,7 +3958,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3968,7 +3968,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3978,7 +3978,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=wt test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3988,7 +3988,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -3998,7 +3998,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4008,7 +4008,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4018,7 +4018,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../wt test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY/27/wt\n@@ -4028,7 +4028,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/27/wt\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4038,7 +4038,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4048,7 +4048,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4058,7 +4058,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=.. test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >27/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4068,7 +4068,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4078,7 +4078,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4088,7 +4088,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4098,7 +4098,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/27/.git\" GIT_WORK_TREE=../../../ test_repo 27/sub/sub\n '\n \n-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >27/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/27.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4235,7 +4235,7 @@ test_expect_success '#30: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#30: at root' '\n+test_expect_success '#30: at root' '\n \t(\n \tcd 30 &&\n \tGIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&\n@@ -4272,7 +4272,7 @@ test_expect_success '#31: setup' '\n \tcd ..\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4282,7 +4282,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4292,7 +4292,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4302,7 +4302,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4312,7 +4312,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4322,7 +4322,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4332,7 +4332,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '\n \tcat >31/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4342,7 +4342,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31\" test_repo 31/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31\n@@ -4352,7 +4352,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4362,7 +4362,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4372,7 +4372,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=wt test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4382,7 +4382,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=wt test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4392,7 +4392,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4402,7 +4402,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4412,7 +4412,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4422,7 +4422,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../wt test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY/31/wt\n@@ -4432,7 +4432,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY/31/wt\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4442,7 +4442,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4452,7 +4452,7 @@ EOF\n \tGIT_DIR=.git GIT_WORK_TREE=.. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4462,7 +4462,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=.. test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '\n \tcat >31/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4472,7 +4472,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4482,7 +4482,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=\"$TRASH_DIRECTORY\" test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4492,7 +4492,7 @@ EOF\n \tGIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n@@ -4502,7 +4502,7 @@ EOF\n \tGIT_DIR=\"$TRASH_DIRECTORY/31/.git\" GIT_WORK_TREE=../../../ test_repo 31/sub/sub\n '\n \n-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '\n \tcat >31/sub/sub/expected <<EOF &&\n setup: git_dir: $TRASH_DIRECTORY/31.git\n setup: worktree: $TRASH_DIRECTORY\n-- \n1.7.3.2.210.g045198\n"},{"id":"155695","messageId":"1289485248-8966-5-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 4/7] Remove all logic from get_git_work_tree()","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:45Z","receivedAt":"2010-11-11T14:20:45Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"This logic is now only used by cmd_init_db(). setup_* functions do not\nrely on it any more. Move all the logic to cmd_init_db() and turn\nget_git_work_tree() into a simple function.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/init-db.c |   14 +++++++++++---\n cache.h           |    1 -\n environment.c     |   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.210.g045198\n"},{"id":"155696","messageId":"1289485248-8966-6-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 5/7] t0001: test git init when run via an alias","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:46Z","receivedAt":"2010-11-11T14:20:46Z","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>\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.210.g045198\n"},{"id":"155697","messageId":"1289485248-8966-7-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 6/7] Revert \"Documentation: always respect core.worktree if set\"","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-11-11T14:20:47Z","receivedAt":"2010-11-11T14:20:47Z","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>\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 71ddb6c..be87123 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.210.g045198\n"},{"id":"155698","messageId":"1289485248-8966-8-git-send-email-pclouds@gmail.com","threadId":"25712","inReplyTo":"1289485248-8966-1-git-send-email-pclouds@gmail.com","subject":"[PATCH 7/7] 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-11T14:20:48Z","receivedAt":"2010-11-11T14:20:48Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Documentation/git.txt |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex b46c6f6..971c52a 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -284,7 +284,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.210.g045198\n"}]}