git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] nd/setup fixups
@ 2010-11-11 14:20 Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 1/7] t1020-subdirectory: test alias expansion in a subdirectory Nguyễn Thái Ngọc Duy
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy

This replaces the last three patches in nd/setup in pu (from clean up
setup_discovered_git_dir to t1020-subdirectory)

Changes are:

 - Retain old behavior of setup_discovered_git_dir() when .git is not
   explicitly set by set_git_dir(), but later on by setup_git_env().
   This helps remove the ugly workaround in set_git_dir() earlier.

 - Include t0001 tests from Jonathan. You'll see I sneak more patches
   in from my old nd/setup from time to time, until I push all of them :)

 - set_git_work_tree() now allows multiple calls as long as the new
   worktree and the old one is the same, as Junio suggested.

 - Document update. Turns out not much is needed.

Jonathan Nieder (1):
  t0001: test git init when run via an alias

Michael J Gruber (1):
  t1020-subdirectory: test alias expansion in a subdirectory

Nguyễn Thái Ngọc Duy (5):
  setup: clean up setup_discovered_git_dir()
  setup: rework setup_explicit_git_dir()
  Remove all logic from get_git_work_tree()
  Revert "Documentation: always respect core.worktree if set"
  git.txt: correct where --work-tree path is relative to

 Documentation/config.txt |   23 ++---
 Documentation/git.txt    |    2 +-
 builtin/init-db.c        |   14 ++-
 cache.h                  |    1 -
 environment.c            |   32 ++----
 setup.c                  |  208 +++++++++++++++++--------------
 t/t0001-init.sh          |   56 +++++++++
 t/t1020-subdirectory.sh  |    8 ++
 t/t1510-repo-setup.sh    |  310 +++++++++++++++++++++++-----------------------
 9 files changed, 360 insertions(+), 294 deletions(-)

-- 
1.7.3.2.210.g045198

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] t1020-subdirectory: test alias expansion in a subdirectory
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 2/7] setup: clean up setup_discovered_git_dir() Nguyễn Thái Ngọc Duy
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano
  Cc: Michael J Gruber, Nguyễn Thái Ngọc Duy

From: Michael J Gruber <git@drmicha.warpmail.net>

Add a test for alias expansion in a subdirectory of the worktree.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t1020-subdirectory.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh
index a3ac338..1fd187c 100755
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
@@ -110,6 +110,14 @@ test_expect_success 'read-tree' '
 	)
 '
 
+test_expect_success 'alias expansion' '
+	(
+		git config alias.ss status &&
+		cd dir &&
+		git status &&
+		git ss
+	)
+'
 test_expect_success 'no file/rev ambiguity check inside .git' '
 	git commit -a -m 1 &&
 	(
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] setup: clean up setup_discovered_git_dir()
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 1/7] t1020-subdirectory: test alias expansion in a subdirectory Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 3/7] setup: rework setup_explicit_git_dir() Nguyễn Thái Ngọc Duy
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy

If core.bare is true, discard the discovered worktree, move back to
original cwd.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 setup.c               |   72 ++++++++++++++++++++++++------------------------
 t/t1510-repo-setup.sh |   24 ++++++++--------
 2 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/setup.c b/setup.c
index a6cc044..3ee9c2e 100644
--- a/setup.c
+++ b/setup.c
@@ -362,39 +362,27 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,
 	return retval;
 }
 
-static int cwd_contains_git_dir(const char **gitfile_dirp)
+static const char *setup_discovered_git_dir(const char *gitdir,
+					    char *cwd, int offset, int len,
+					    int *nongit_ok)
 {
-	const char *gitfile_dir = read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
-	*gitfile_dirp = gitfile_dir;
-	if (gitfile_dir) {
-		if (set_git_dir(gitfile_dir))
-			die("Repository setup failed");
-		return 1;
-	}
-	if (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT)) {
-		*gitfile_dirp = DEFAULT_GIT_DIR_ENVIRONMENT;
-		return 1;
-	}
-	return 0;
-}
+	if (check_repository_format_gently(gitdir, nongit_ok))
+		return NULL;
 
-static const char *setup_discovered_git_dir(const char *work_tree_env,
-					    const char *gitdir,
-					    int offset, int len,
-					    char *cwd, int *nongit_ok)
-{
-	int root_len;
-	char *work_tree;
+	/* #16.2, #17.2, #20.2, #21.2, #24, #25, #28, #29 (see t1510) */
+	if (is_bare_repository_cfg > 0) {
+		set_git_dir(offset == len ? gitdir : make_absolute_path(gitdir));
+		if (chdir(cwd))
+			die_errno("Could not come back to cwd");
+		return NULL;
+	}
 
+	/* #0, #1, #5, #8, #9, #12, #13 */
+	set_git_work_tree(".");
+	if (strcmp(gitdir, DEFAULT_GIT_DIR_ENVIRONMENT))
+		set_git_dir(gitdir);
 	inside_git_dir = 0;
-	if (!work_tree_env)
-		inside_work_tree = 1;
-	root_len = offset_1st_component(cwd);
-	work_tree = xstrndup(cwd, offset > root_len ? offset : root_len);
-	set_git_work_tree(work_tree);
-	free(work_tree);
-	if (check_repository_format_gently(gitdir, nongit_ok))
-		return NULL;
+	inside_work_tree = 1;
 	if (offset == len)
 		return NULL;
 
@@ -456,8 +444,8 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 	const char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);
 	const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
 	static char cwd[PATH_MAX+1];
-	const char *gitdirenv;
-	const char *gitfile_dir;
+	const char *gitdirenv, *ret;
+	char *gitfile;
 	int len, offset, ceil_offset;
 	dev_t current_device = 0;
 	int one_filesystem = 1;
@@ -502,11 +490,23 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 	if (one_filesystem)
 		current_device = get_device_or_die(".", NULL);
 	for (;;) {
-		if (cwd_contains_git_dir(&gitfile_dir))
-			return setup_discovered_git_dir(work_tree_env,
-							gitfile_dir,
-							offset, len,
-							cwd, nongit_ok);
+		gitfile = (char*)read_gitfile_gently(DEFAULT_GIT_DIR_ENVIRONMENT);
+		if (gitfile)
+			gitdirenv = gitfile = xstrdup(gitfile);
+		else {
+			if (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))
+				gitdirenv = DEFAULT_GIT_DIR_ENVIRONMENT;
+		}
+
+		if (gitdirenv) {
+			ret = setup_discovered_git_dir(gitdirenv,
+						       cwd, offset, len,
+						       nongit_ok);
+			free(gitfile);
+			return ret;
+		}
+		free(gitfile);
+
 		if (is_git_directory("."))
 			return setup_bare_git_dir(cwd, offset, len, nongit_ok);
 
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index 629ba34..d492996 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -2343,7 +2343,7 @@ EOF
 	test_repo 16
 '
 
-test_expect_failure '#16.2: in subdir' '
+test_expect_success '#16.2: in subdir' '
 	cat >16/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/16/.git
 setup: worktree: (null)
@@ -2471,7 +2471,7 @@ EOF
 	test_repo 17
 '
 
-test_expect_failure '#17.2: in subdir' '
+test_expect_success '#17.2: in subdir' '
 	cat >17/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/17/.git
 setup: worktree: (null)
@@ -2936,7 +2936,7 @@ EOF
 	test_repo 20
 '
 
-test_expect_failure '#20.2: in subdir' '
+test_expect_success '#20.2: in subdir' '
 	cat >20/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/20/.git
 setup: worktree: (null)
@@ -3065,7 +3065,7 @@ EOF
 	test_repo 21
 '
 
-test_expect_failure '#21.2: in subdir' '
+test_expect_success '#21.2: in subdir' '
 	cat >21/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/21/.git
 setup: worktree: (null)
@@ -3703,7 +3703,7 @@ test_expect_success '#24: setup' '
 	cd ..
 '
 
-test_expect_failure '#24: at root' '
+test_expect_success '#24: at root' '
 	cat >24/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/24.git
 setup: worktree: (null)
@@ -3713,7 +3713,7 @@ EOF
 	test_repo 24
 '
 
-test_expect_failure '#24: in subdir' '
+test_expect_success '#24: in subdir' '
 	cat >24/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/24.git
 setup: worktree: (null)
@@ -3752,7 +3752,7 @@ test_expect_success '#25: setup' '
 	cd ..
 '
 
-test_expect_failure '#25: at root' '
+test_expect_success '#25: at root' '
 	cat >25/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/25.git
 setup: worktree: (null)
@@ -3762,7 +3762,7 @@ EOF
 	test_repo 25
 '
 
-test_expect_failure '#25: in subdir' '
+test_expect_success '#25: in subdir' '
 	cat >25/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/25.git
 setup: worktree: (null)
@@ -4137,7 +4137,7 @@ test_expect_success '#28: setup' '
 	cd ..
 '
 
-test_expect_failure '#28: at root' '
+test_expect_success '#28: at root' '
 	cat >28/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/28.git
 setup: worktree: (null)
@@ -4147,7 +4147,7 @@ EOF
 	test_repo 28
 '
 
-test_expect_failure '#28: in subdir' '
+test_expect_success '#28: in subdir' '
 	cat >28/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/28.git
 setup: worktree: (null)
@@ -4186,7 +4186,7 @@ test_expect_success '#29: setup' '
 	cd ..
 '
 
-test_expect_failure '#29: at root' '
+test_expect_success '#29: at root' '
 	cat >29/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/29.git
 setup: worktree: (null)
@@ -4196,7 +4196,7 @@ EOF
 	test_repo 29
 '
 
-test_expect_failure '#29: in subdir' '
+test_expect_success '#29: in subdir' '
 	cat >29/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/29.git
 setup: worktree: (null)
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] setup: rework setup_explicit_git_dir()
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 1/7] t1020-subdirectory: test alias expansion in a subdirectory Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 2/7] setup: clean up setup_discovered_git_dir() Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 4/7] Remove all logic from get_git_work_tree() Nguyễn Thái Ngọc Duy
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy

This function is the most complex one among the three setup_*
functions because all GIT_DIR, GIT_WORK_TREE, core.worktree and
core.bare are involved.

Because core.worktree is only effective inside
setup_explicit_git_dir() and the extra code in setup_git_directory()
is to handle that. The extra code can now be retired.

Also note that setup_explicit assignment is removed, worktree setting
is no longer decided by get_git_work_tree(). get_git_work_tree() will
be simplified in the next commit.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 setup.c               |  138 +++++++++++++----------
 t/t1510-repo-setup.sh |  286 ++++++++++++++++++++++++------------------------
 2 files changed, 221 insertions(+), 203 deletions(-)

diff --git a/setup.c b/setup.c
index 3ee9c2e..2e2865c 100644
--- a/setup.c
+++ b/setup.c
@@ -208,24 +208,6 @@ int is_inside_work_tree(void)
 	return inside_work_tree;
 }
 
-/*
- * set_work_tree() is only ever called if you set GIT_DIR explicitly.
- * The old behaviour (which we retain here) is to set the work tree root
- * to the cwd, unless overridden by the config, the command line, or
- * GIT_WORK_TREE.
- */
-static const char *set_work_tree(const char *dir)
-{
-	char buffer[PATH_MAX + 1];
-
-	if (!getcwd(buffer, sizeof(buffer)))
-		die ("Could not get the current working directory");
-	git_work_tree_cfg = xstrdup(buffer);
-	inside_work_tree = 1;
-
-	return NULL;
-}
-
 void setup_work_tree(void)
 {
 	const char *work_tree, *git_dir;
@@ -326,40 +308,92 @@ const char *read_gitfile_gently(const char *path)
 }
 
 static const char *setup_explicit_git_dir(const char *gitdirenv,
-				const char *work_tree_env, int *nongit_ok)
+					  char *cwd, int len,
+					  int *nongit_ok)
 {
-	static char buffer[1024 + 1];
-	const char *retval;
+	const char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);
+	const char *worktree;
+	char *gitfile;
 
-	if (startup_info)
-		startup_info->setup_explicit = 1;
 	if (PATH_MAX - 40 < strlen(gitdirenv))
 		die("'$%s' too big", GIT_DIR_ENVIRONMENT);
+
+	gitfile = (char*)read_gitfile_gently(gitdirenv);
+	if (gitfile) {
+		gitfile = xstrdup(gitfile);
+		gitdirenv = gitfile;
+	}
+
 	if (!is_git_directory(gitdirenv)) {
 		if (nongit_ok) {
 			*nongit_ok = 1;
+			free(gitfile);
 			return NULL;
 		}
 		die("Not a git repository: '%s'", gitdirenv);
 	}
-	if (!work_tree_env) {
-		retval = set_work_tree(gitdirenv);
-		/* config may override worktree */
-		if (check_repository_format_gently(gitdirenv, nongit_ok))
-			return NULL;
-		return retval;
+
+	if (check_repository_format_gently(gitdirenv, nongit_ok)) {
+		free(gitfile);
+		return NULL;
 	}
-	if (check_repository_format_gently(gitdirenv, nongit_ok))
+
+	/* #3, #7, #11, #15, #19, #23, #27, #31 (see t1510) */
+	if (work_tree_env)
+		set_git_work_tree(work_tree_env);
+	else if (is_bare_repository_cfg > 0) {
+		if (git_work_tree_cfg) /* #22.2, #30 */
+			die("core.bare and core.worktree do not make sense");
+
+		/* #18, #26 */
+		set_git_dir(gitdirenv);
+		free(gitfile);
 		return NULL;
-	retval = get_relative_cwd(buffer, sizeof(buffer) - 1,
-			get_git_work_tree());
-	if (!retval || !*retval)
+	}
+	else if (git_work_tree_cfg) { /* #6, #14 */
+		if (is_absolute_path(git_work_tree_cfg))
+			set_git_work_tree(git_work_tree_cfg);
+		else {
+			char core_worktree[PATH_MAX];
+			if (chdir(gitdirenv))
+				die_errno("Could not chdir to '%s'", gitdirenv);
+			if (chdir(git_work_tree_cfg))
+				die_errno("Could not chdir to '%s'", git_work_tree_cfg);
+			if (!getcwd(core_worktree, PATH_MAX))
+				die_errno("Could not get directory '%s'", git_work_tree_cfg);
+			if (chdir(cwd))
+				die_errno("Could not come back to cwd");
+			set_git_work_tree(core_worktree);
+		}
+	}
+	else /* #2, #10 */
+		set_git_work_tree(".");
+
+	/* set_git_work_tree() must have been called by now */
+	worktree = get_git_work_tree();
+
+	/* both get_git_work_tree() and cwd are already normalized */
+	if (!strcmp(cwd, worktree)) { /* cwd == worktree */
+		set_git_dir(gitdirenv);
+		free(gitfile);
 		return NULL;
-	set_git_dir(make_absolute_path(gitdirenv));
-	if (chdir(work_tree_env) < 0)
-		die_errno ("Could not chdir to '%s'", work_tree_env);
-	strcat(buffer, "/");
-	return retval;
+	}
+
+	if (!prefixcmp(cwd, worktree) &&
+	    cwd[strlen(worktree)] == '/') { /* cwd inside worktree */
+		set_git_dir(make_absolute_path(gitdirenv));
+		if (chdir(worktree))
+			die_errno("Could not chdir to '%s'", worktree);
+		cwd[len++] = '/';
+		cwd[len] = '\0';
+		free(gitfile);
+		return cwd + strlen(worktree) + 1;
+	}
+
+	/* cwd outside worktree */
+	set_git_dir(gitdirenv);
+	free(gitfile);
+	return NULL;
 }
 
 static const char *setup_discovered_git_dir(const char *gitdir,
@@ -441,7 +475,6 @@ static dev_t get_device_or_die(const char *path, const char *prefix)
  */
 static const char *setup_git_directory_gently_1(int *nongit_ok)
 {
-	const char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);
 	const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
 	static char cwd[PATH_MAX+1];
 	const char *gitdirenv, *ret;
@@ -458,6 +491,10 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 	if (nongit_ok)
 		*nongit_ok = 0;
 
+	if (!getcwd(cwd, sizeof(cwd)-1))
+		die_errno("Unable to read current working directory");
+	offset = len = strlen(cwd);
+
 	/*
 	 * If GIT_DIR is set explicitly, we're not going
 	 * to do any discovery, but we still do repository
@@ -465,10 +502,7 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 	 */
 	gitdirenv = getenv(GIT_DIR_ENVIRONMENT);
 	if (gitdirenv)
-		return setup_explicit_git_dir(gitdirenv, work_tree_env, nongit_ok);
-
-	if (!getcwd(cwd, sizeof(cwd)-1))
-		die_errno("Unable to read current working directory");
+		return setup_explicit_git_dir(gitdirenv, cwd, len, nongit_ok);
 
 	ceil_offset = longest_ancestor_length(cwd, env_ceiling_dirs);
 	if (ceil_offset < 0 && has_dos_drive_prefix(cwd))
@@ -485,7 +519,6 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
 	 * - ../../.git/
 	 *   etc.
 	 */
-	offset = len = strlen(cwd);
 	one_filesystem = !git_env_bool("GIT_DISCOVERY_ACROSS_FILESYSTEM", 0);
 	if (one_filesystem)
 		current_device = get_device_or_die(".", NULL);
@@ -628,20 +661,5 @@ int check_repository_format(void)
  */
 const char *setup_git_directory(void)
 {
-	const char *retval = setup_git_directory_gently(NULL);
-
-	/* If the work tree is not the default one, recompute prefix */
-	if ((!startup_info || startup_info->setup_explicit) &&
-	    inside_work_tree < 0) {
-		static char buffer[PATH_MAX + 1];
-		char *rel;
-		if (retval && chdir(retval))
-			die_errno ("Could not jump back into original cwd");
-		rel = get_relative_cwd(buffer, PATH_MAX, get_git_work_tree());
-		if (rel && *rel && chdir(get_git_work_tree()))
-			die_errno ("Could not jump to working directory");
-		return rel && *rel ? strcat(rel, "/") : NULL;
-	}
-
-	return retval;
+	return setup_git_directory_gently(NULL);
 }
diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
index d492996..0343045 100755
--- a/t/t1510-repo-setup.sh
+++ b/t/t1510-repo-setup.sh
@@ -647,7 +647,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/6/.git" test_repo 6
 '
 
-test_expect_failure '#6: GIT_DIR(rel), core.worktree=.. in subdir' '
+test_expect_success '#6: GIT_DIR(rel), core.worktree=.. in subdir' '
 	cat >6/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/6/.git
 setup: worktree: $TRASH_DIRECTORY/6
@@ -658,7 +658,7 @@ EOF
 	GIT_DIR=../../.git test_repo 6/sub/sub
 '
 
-test_expect_failure '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '
+test_expect_success '#6: GIT_DIR(rel), core.worktree=..(rel) in subdir' '
 	cat >6/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/6/.git
 setup: worktree: $TRASH_DIRECTORY/6
@@ -779,7 +779,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/6/.git" test_repo 6/sub/sub
 '
 
-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. at root' '
+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. at root' '
 	cat >6/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/6/.git
 setup: worktree: $TRASH_DIRECTORY
@@ -790,7 +790,7 @@ EOF
 	GIT_DIR=.git test_repo 6
 '
 
-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '
+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) at root' '
 	cat >6/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/6/.git
 setup: worktree: $TRASH_DIRECTORY
@@ -823,7 +823,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/6/.git" test_repo 6
 '
 
-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '
+test_expect_success '#6: GIT_DIR(rel), core.worktree=../.. in subdir' '
 	cat >6/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/6/.git
 setup: worktree: $TRASH_DIRECTORY
@@ -834,7 +834,7 @@ EOF
 	GIT_DIR=../../.git test_repo 6/sub/sub
 '
 
-test_expect_failure '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '
+test_expect_success '#6: GIT_DIR(rel), core.worktree=../..(rel) in subdir' '
 	cat >6/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/6/.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1254,7 +1254,7 @@ test_expect_success '#10: setup' '
 	cd ..
 '
 
-test_expect_failure '#10: at root' '
+test_expect_success '#10: at root' '
 	cat >10/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/10.git
 setup: worktree: $TRASH_DIRECTORY/10
@@ -1264,7 +1264,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/10/.git" test_repo 10
 '
 
-test_expect_failure '#10: in subdir' '
+test_expect_success '#10: in subdir' '
 	cat >10/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/10.git
 setup: worktree: $TRASH_DIRECTORY/10/sub
@@ -1274,7 +1274,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/10/.git" test_repo 10/sub
 '
 
-test_expect_failure '#10: relative GIT_DIR at root' '
+test_expect_success '#10: relative GIT_DIR at root' '
 	cat >10/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/10.git
 setup: worktree: $TRASH_DIRECTORY/10
@@ -1284,7 +1284,7 @@ EOF
 	GIT_DIR=.git test_repo 10
 '
 
-test_expect_failure '#10: relative GIT_DIR in subdir' '
+test_expect_success '#10: relative GIT_DIR in subdir' '
 	cat >10/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/10.git
 setup: worktree: $TRASH_DIRECTORY/10/sub
@@ -1321,7 +1321,7 @@ test_expect_success '#11: setup' '
 	cd ..
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1331,7 +1331,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/11" test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1341,7 +1341,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=. test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root at root' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1351,7 +1351,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/11" test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1361,7 +1361,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE=. test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1371,7 +1371,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/11" test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1381,7 +1381,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '
+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root in subdir' '
 	cat >11/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1391,7 +1391,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/11" test_repo 11/sub
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#11: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11
@@ -1401,7 +1401,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE=../.. test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1411,7 +1411,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/11/wt" test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1421,7 +1421,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=wt test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1431,7 +1431,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE=wt test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1441,7 +1441,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/11/wt" test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1451,7 +1451,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/11/wt" test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1461,7 +1461,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1471,7 +1471,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE=../../wt test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY/11/wt
@@ -1481,7 +1481,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/11/wt" test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1491,7 +1491,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1501,7 +1501,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=.. test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1511,7 +1511,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE=.. test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. at root' '
 	cat >11/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1521,7 +1521,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 11
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1531,7 +1531,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1541,7 +1541,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1551,7 +1551,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/11/.git" GIT_WORK_TREE=../../../ test_repo 11/sub/sub
 '
 
-test_expect_failure '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#11: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
 	cat >11/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/11.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1686,7 +1686,7 @@ test_expect_success '#14: setup' '
 	cd ..
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 at root' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1697,7 +1697,7 @@ EOF
 	GIT_DIR=.git test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1708,7 +1708,7 @@ EOF
 	GIT_DIR=.git test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14 at root' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14 at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1719,7 +1719,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) at root' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1730,7 +1730,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14 in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1741,7 +1741,7 @@ EOF
 	GIT_DIR=../../.git test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14(rel) in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1752,7 +1752,7 @@ EOF
 	GIT_DIR=../../.git test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14 in subdir' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14 in subdir' '
 	cat >14/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1763,7 +1763,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14(rel) in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14
@@ -1774,7 +1774,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1785,7 +1785,7 @@ EOF
 	GIT_DIR=.git test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1796,7 +1796,7 @@ EOF
 	GIT_DIR=.git test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1807,7 +1807,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt at root' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1818,7 +1818,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1829,7 +1829,7 @@ EOF
 	GIT_DIR=../../.git test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=../14/wt(rel) in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1840,7 +1840,7 @@ EOF
 	GIT_DIR=../../.git test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt(rel) in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1851,7 +1851,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=../14/wt in subdir' '
+test_expect_success '#14: GIT_DIR, core.worktree=../14/wt in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY/14/wt
@@ -1862,7 +1862,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. at root' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1873,7 +1873,7 @@ EOF
 	GIT_DIR=.git test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1884,7 +1884,7 @@ EOF
 	GIT_DIR=.git test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) at root' '
+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1895,7 +1895,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=.. at root' '
+test_expect_success '#14: GIT_DIR, core.worktree=.. at root' '
 	cat >14/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1906,7 +1906,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=.. in subdir' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=.. in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1917,7 +1917,7 @@ EOF
 	GIT_DIR=../../.git test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '
+test_expect_success '#14: GIT_DIR(rel), core.worktree=..(rel) in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1928,7 +1928,7 @@ EOF
 	GIT_DIR=../../.git test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=..(rel) in subdir' '
+test_expect_success '#14: GIT_DIR, core.worktree=..(rel) in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1939,7 +1939,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/14/.git" test_repo 14/sub/sub
 '
 
-test_expect_failure '#14: GIT_DIR, core.worktree=.. in subdir' '
+test_expect_success '#14: GIT_DIR, core.worktree=.. in subdir' '
 	cat >14/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/14.git
 setup: worktree: $TRASH_DIRECTORY
@@ -1978,7 +1978,7 @@ test_expect_success '#15: setup' '
 	cd ..
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -1988,7 +1988,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/15" test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -1998,7 +1998,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=. test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root at root' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -2008,7 +2008,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/15" test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -2018,7 +2018,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE=. test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -2028,7 +2028,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/15" test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -2038,7 +2038,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '
+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root in subdir' '
 	cat >15/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -2048,7 +2048,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/15" test_repo 15/sub
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#15: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15
@@ -2058,7 +2058,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE=../.. test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2068,7 +2068,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/15/wt" test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2078,7 +2078,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=wt test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2088,7 +2088,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE=wt test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2098,7 +2098,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/15/wt" test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2108,7 +2108,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/15/wt" test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2118,7 +2118,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2128,7 +2128,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE=../../wt test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY/15/wt
@@ -2138,7 +2138,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/15/wt" test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2148,7 +2148,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2158,7 +2158,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=.. test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2168,7 +2168,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE=.. test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. at root' '
 	cat >15/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2178,7 +2178,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 15
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2188,7 +2188,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2198,7 +2198,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -2208,7 +2208,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/15/.git" GIT_WORK_TREE=../../../ test_repo 15/sub/sub
 '
 
-test_expect_failure '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#15: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
 	cat >15/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/15.git
 setup: worktree: $TRASH_DIRECTORY
@@ -3151,7 +3151,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/22/.git" test_repo 22/.git
 '
 
-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '
+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=. in .git/sub' '
 	cat >22/.git/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/22/.git
 setup: worktree: $TRASH_DIRECTORY/22/.git
@@ -3162,7 +3162,7 @@ EOF
 	GIT_DIR=.. test_repo 22/.git/sub
 '
 
-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '
+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.(rel) in .git/sub' '
 	cat >22/.git/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/22/.git
 setup: worktree: $TRASH_DIRECTORY/22/.git
@@ -3283,7 +3283,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/22/.git" test_repo 22/.git/sub
 '
 
-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '
+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. at .git' '
 	cat >22/.git/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/22/.git
 setup: worktree: $TRASH_DIRECTORY/22
@@ -3294,7 +3294,7 @@ EOF
 	GIT_DIR=. test_repo 22/.git
 '
 
-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '
+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) at .git' '
 	cat >22/.git/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/22/.git
 setup: worktree: $TRASH_DIRECTORY/22
@@ -3327,7 +3327,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/22/.git" test_repo 22/.git
 '
 
-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '
+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=.. in .git/sub' '
 	cat >22/.git/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/22/.git
 setup: worktree: $TRASH_DIRECTORY/22
@@ -3338,7 +3338,7 @@ EOF
 	GIT_DIR=.. test_repo 22/.git/sub
 '
 
-test_expect_failure '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '
+test_expect_success '#22.1: GIT_DIR(rel), core.worktree=..(rel) in .git/sub' '
 	cat >22/.git/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/22/.git
 setup: worktree: $TRASH_DIRECTORY/22
@@ -3392,7 +3392,7 @@ test_expect_success '#22.2: setup' '
 	git config --file="$TRASH_DIRECTORY/22/.git/config" core.bare true
 '
 
-test_expect_failure '#22.2: at .git' '
+test_expect_success '#22.2: at .git' '
 	(
 	cd 22/.git &&
 	GIT_DIR=. test_must_fail git symbolic-ref HEAD 2>result &&
@@ -3400,7 +3400,7 @@ test_expect_failure '#22.2: at .git' '
 	)
 '
 
-test_expect_failure '#22.2: at root' '
+test_expect_success '#22.2: at root' '
 	(
 	cd 22 &&
 	GIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&
@@ -3800,7 +3800,7 @@ test_expect_success '#26: setup' '
 	cd ..
 '
 
-test_expect_failure '#26: (rel) at root' '
+test_expect_success '#26: (rel) at root' '
 	cat >26/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/26.git
 setup: worktree: (null)
@@ -3810,7 +3810,7 @@ EOF
 	 GIT_DIR=.git test_repo 26
 '
 
-test_expect_failure '#26: at root' '
+test_expect_success '#26: at root' '
 	cat >26/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/26.git
 setup: worktree: (null)
@@ -3820,7 +3820,7 @@ EOF
 	 GIT_DIR="$TRASH_DIRECTORY/26/.git" test_repo 26
 '
 
-test_expect_failure '#26: (rel) in subdir' '
+test_expect_success '#26: (rel) in subdir' '
 	cat >26/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/26.git
 setup: worktree: (null)
@@ -3830,7 +3830,7 @@ EOF
 	GIT_DIR=../.git test_repo 26/sub
 '
 
-test_expect_failure '#26: in subdir' '
+test_expect_success '#26: in subdir' '
 	cat >26/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/26.git
 setup: worktree: (null)
@@ -3868,7 +3868,7 @@ test_expect_success '#27: setup' '
 	cd ..
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3878,7 +3878,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3888,7 +3888,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=. test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root at root' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3898,7 +3898,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3908,7 +3908,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=. test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3918,7 +3918,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3928,7 +3928,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '
+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root in subdir' '
 	cat >27/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3938,7 +3938,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27" test_repo 27/sub
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#27: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27
@@ -3948,7 +3948,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=../.. test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -3958,7 +3958,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -3968,7 +3968,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=wt test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -3978,7 +3978,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=wt test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -3988,7 +3988,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -3998,7 +3998,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -4008,7 +4008,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -4018,7 +4018,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=../../wt test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY/27/wt
@@ -4028,7 +4028,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/27/wt" test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4038,7 +4038,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4048,7 +4048,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=.. test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4058,7 +4058,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=.. test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. at root' '
 	cat >27/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4068,7 +4068,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4078,7 +4078,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#27: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4088,7 +4088,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4098,7 +4098,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/27/.git" GIT_WORK_TREE=../../../ test_repo 27/sub/sub
 '
 
-test_expect_failure '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#27: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
 	cat >27/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/27.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4235,7 +4235,7 @@ test_expect_success '#30: setup' '
 	cd ..
 '
 
-test_expect_failure '#30: at root' '
+test_expect_success '#30: at root' '
 	(
 	cd 30 &&
 	GIT_DIR=.git test_must_fail git symbolic-ref HEAD 2>result &&
@@ -4272,7 +4272,7 @@ test_expect_success '#31: setup' '
 	cd ..
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4282,7 +4282,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/31" test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=root(rel) at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4292,7 +4292,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=. test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root at root' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4302,7 +4302,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/31" test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=root(rel) at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4312,7 +4312,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE=. test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4322,7 +4322,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/31" test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORKTREE=root(rel) in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4332,7 +4332,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../.. test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '
+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root in subdir' '
 	cat >31/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4342,7 +4342,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/31" test_repo 31/sub
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
+test_expect_success '#31: GIT_DIR, GIT_WORKTREE=root(rel) in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31
@@ -4352,7 +4352,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE=../.. test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4362,7 +4362,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY/31/wt" test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4372,7 +4372,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=wt test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4382,7 +4382,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE=wt test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4392,7 +4392,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/31/wt" test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4402,7 +4402,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY/31/wt" test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4412,7 +4412,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../wt test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4422,7 +4422,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE=../../wt test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=wt in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY/31/wt
@@ -4432,7 +4432,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE="$TRASH_DIRECTORY/31/wt" test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4442,7 +4442,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4452,7 +4452,7 @@ EOF
 	GIT_DIR=.git GIT_WORK_TREE=.. test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4462,7 +4462,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE=.. test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. at root' '
 	cat >31/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4472,7 +4472,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 31
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4482,7 +4482,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE="$TRASH_DIRECTORY" test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#31: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4492,7 +4492,7 @@ EOF
 	GIT_DIR=../../.git GIT_WORK_TREE=../../.. test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
@@ -4502,7 +4502,7 @@ EOF
 	GIT_DIR="$TRASH_DIRECTORY/31/.git" GIT_WORK_TREE=../../../ test_repo 31/sub/sub
 '
 
-test_expect_failure '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
+test_expect_success '#31: GIT_DIR, GIT_WORK_TREE=.. in subdir' '
 	cat >31/sub/sub/expected <<EOF &&
 setup: git_dir: $TRASH_DIRECTORY/31.git
 setup: worktree: $TRASH_DIRECTORY
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] Remove all logic from get_git_work_tree()
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
                   ` (2 preceding siblings ...)
  2010-11-11 14:20 ` [PATCH 3/7] setup: rework setup_explicit_git_dir() Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 5/7] t0001: test git init when run via an alias Nguyễn Thái Ngọc Duy
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy

This logic is now only used by cmd_init_db(). setup_* functions do not
rely on it any more. Move all the logic to cmd_init_db() and turn
get_git_work_tree() into a simple function.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/init-db.c |   14 +++++++++++---
 cache.h           |    1 -
 environment.c     |   32 ++++++++------------------------
 3 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index ea06478..e3af9ea 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -414,6 +414,7 @@ static const char *const init_db_usage[] = {
 int cmd_init_db(int argc, const char **argv, const char *prefix)
 {
 	const char *git_dir;
+	const char *work_tree;
 	const char *template_dir = NULL;
 	unsigned int flags = 0;
 	const struct option init_db_options[] = {
@@ -480,8 +481,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	 * without --bare.  Catch the error early.
 	 */
 	git_dir = getenv(GIT_DIR_ENVIRONMENT);
-	if ((!git_dir || is_bare_repository_cfg == 1)
-	    && getenv(GIT_WORK_TREE_ENVIRONMENT))
+	work_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);
+	if ((!git_dir || is_bare_repository_cfg == 1) && work_tree)
 		die("%s (or --work-tree=<directory>) not allowed without "
 		    "specifying %s (or --git-dir=<directory>)",
 		    GIT_WORK_TREE_ENVIRONMENT,
@@ -496,7 +497,6 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	if (is_bare_repository_cfg < 0)
 		is_bare_repository_cfg = guess_repository_type(git_dir);
 
-	startup_info->setup_explicit = 1;
 	if (!is_bare_repository_cfg) {
 		if (git_dir) {
 			const char *git_dir_parent = strrchr(git_dir, '/');
@@ -511,10 +511,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 			if (!getcwd(git_work_tree_cfg, PATH_MAX))
 				die_errno ("Cannot access current working directory");
 		}
+		if (work_tree)
+			set_git_work_tree(make_absolute_path(work_tree));
+		else
+			set_git_work_tree(git_work_tree_cfg);
 		if (access(get_git_work_tree(), X_OK))
 			die_errno ("Cannot access work tree '%s'",
 				   get_git_work_tree());
 	}
+	else {
+		if (work_tree)
+			set_git_work_tree(make_absolute_path(work_tree));
+	}
 
 	set_git_dir(make_absolute_path(git_dir));
 
diff --git a/cache.h b/cache.h
index b2cdda7..123dd4b 100644
--- a/cache.h
+++ b/cache.h
@@ -1119,7 +1119,6 @@ const char *split_cmdline_strerror(int cmdline_errno);
 /* git.c */
 struct startup_info {
 	int have_repository;
-	int setup_explicit;
 };
 extern struct startup_info *startup_info;
 
diff --git a/environment.c b/environment.c
index d811049..149c132 100644
--- a/environment.c
+++ b/environment.c
@@ -137,36 +137,20 @@ static int git_work_tree_initialized;
  */
 void set_git_work_tree(const char *new_work_tree)
 {
+	if (git_work_tree_initialized) {
+		new_work_tree = make_absolute_path(new_work_tree);
+		if (strcmp(new_work_tree, work_tree))
+			die("internal error: work tree has already been set\n"
+			    "Current worktree: %s\nNew worktree: %s",
+			    work_tree, new_work_tree);
+		return;
+	}
 	git_work_tree_initialized = 1;
-	free(work_tree);
 	work_tree = xstrdup(make_absolute_path(new_work_tree));
-	is_bare_repository_cfg = 0;
 }
 
 const char *get_git_work_tree(void)
 {
-	if (startup_info && !startup_info->setup_explicit) {
-		if (is_bare_repository_cfg == 1)
-			return NULL;
-		if (work_tree)
-			is_bare_repository_cfg = 0;
-		return work_tree;
-	}
-
-	if (!git_work_tree_initialized) {
-		work_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);
-		/* core.bare = true overrides implicit and config work tree */
-		if (!work_tree && is_bare_repository_cfg < 1) {
-			work_tree = git_work_tree_cfg;
-			/* make_absolute_path also normalizes the path */
-			if (work_tree && !is_absolute_path(work_tree))
-				work_tree = xstrdup(make_absolute_path(git_path("%s", work_tree)));
-		} else if (work_tree)
-			work_tree = xstrdup(make_absolute_path(work_tree));
-		git_work_tree_initialized = 1;
-		if (work_tree)
-			is_bare_repository_cfg = 0;
-	}
 	return work_tree;
 }
 
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] t0001: test git init when run via an alias
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
                   ` (3 preceding siblings ...)
  2010-11-11 14:20 ` [PATCH 4/7] Remove all logic from get_git_work_tree() Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 6/7] Revert "Documentation: always respect core.worktree if set" Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 7/7] git.txt: correct where --work-tree path is relative to Nguyễn Thái Ngọc Duy
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano
  Cc: Jonathan Nieder, Nguyễn Thái Ngọc Duy

From: Jonathan Nieder <jrnieder@gmail.com>

Add some tests to document the correct behavior of (possibly aliased)
init when run within and outside a git directory.

If I set up a simple git alias “quietinit = init --quiet”, usually it
will work just like ‘git init --quiet’.

There are some differences, unfortunately, since in the process of
checking for aliases, git has to look for a .git/config file.  If ‘git
quietinit’ is run from a subdirectory of an existing git repository,
that repository’s configuration will affect the configuration of the
new repository.  In particular, the new repository can inherit
bogus values for core.bare and core.worktree.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 t/t0001-init.sh |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 7fe8883..28c1858 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -33,6 +33,62 @@ test_expect_success 'plain' '
 	check_config plain/.git false unset
 '
 
+test_expect_success 'plain nested in bare' '
+	(
+		unset GIT_DIR GIT_WORK_TREE &&
+		git init --bare bare-ancestor.git &&
+		cd bare-ancestor.git &&
+		mkdir plain-nested &&
+		cd plain-nested &&
+		git init
+	) &&
+	check_config bare-ancestor.git/plain-nested/.git false unset
+'
+
+test_expect_success 'plain through aliased command, outside any git repo' '
+	(
+		unset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&
+		HOME=$(pwd)/alias-config &&
+		export HOME &&
+		mkdir alias-config &&
+		echo "[alias] aliasedinit = init" >alias-config/.gitconfig &&
+
+		GIT_CEILING_DIRECTORIES=$(pwd) &&
+		export GIT_CEILING_DIRECTORIES &&
+
+		mkdir plain-aliased &&
+		cd plain-aliased &&
+		git aliasedinit
+	) &&
+	check_config plain-aliased/.git false unset
+'
+
+test_expect_failure 'plain nested through aliased command' '
+	(
+		unset GIT_DIR GIT_WORK_TREE &&
+		git init plain-ancestor-aliased &&
+		cd plain-ancestor-aliased &&
+		echo "[alias] aliasedinit = init" >>.git/config &&
+		mkdir plain-nested &&
+		cd plain-nested &&
+		git aliasedinit
+	) &&
+	check_config plain-ancestor-aliased/plain-nested/.git false unset
+'
+
+test_expect_failure 'plain nested in bare through aliased command' '
+	(
+		unset GIT_DIR GIT_WORK_TREE &&
+		git init --bare bare-ancestor-aliased.git &&
+		cd bare-ancestor-aliased.git &&
+		echo "[alias] aliasedinit = init" >>config &&
+		mkdir plain-nested &&
+		cd plain-nested &&
+		git aliasedinit
+	) &&
+	check_config bare-ancestor-aliased.git/plain-nested/.git false unset
+'
+
 test_expect_success 'plain with GIT_WORK_TREE' '
 	if (
 		unset GIT_DIR
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] Revert "Documentation: always respect core.worktree if set"
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
                   ` (4 preceding siblings ...)
  2010-11-11 14:20 ` [PATCH 5/7] t0001: test git init when run via an alias Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  2010-11-11 14:20 ` [PATCH 7/7] git.txt: correct where --work-tree path is relative to Nguyễn Thái Ngọc Duy
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy

This reverts commit f5e025a9d5b35e24768475f6890b836ce0d5ed15.

The commit reflected what the code did. But the code did that because
it had bugs.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/config.txt |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 71ddb6c..be87123 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -317,24 +317,17 @@ false), while all other repositories are assumed to be bare (bare
 = true).
 
 core.worktree::
-	Set the path to the root of the work tree.
+	Set the path to the working tree.  The value will not be
+	used in combination with repositories found automatically in
+	a .git directory (i.e. $GIT_DIR is not set).
 	This can be overridden by the GIT_WORK_TREE environment
 	variable and the '--work-tree' command line option. It can be
-	an absolute path or a relative path to the .git directory,
-	either specified by --git-dir or GIT_DIR, or automatically
-	discovered.
-	If --git-dir or GIT_DIR are specified but none of
+	a absolute path or relative path to the directory specified by
+	--git-dir or GIT_DIR.
+	Note: If --git-dir or GIT_DIR are specified but none of
 	--work-tree, GIT_WORK_TREE and core.worktree is specified,
-	the current working directory is regarded as the root of the
-	work tree.
-+
-Note that this variable is honored even when set in a configuration
-file in a ".git" subdirectory of a directory, and its value differs
-from the latter directory (e.g. "/path/to/.git/config" has
-core.worktree set to "/different/path"), which is most likely a
-misconfiguration.  Running git commands in "/path/to" directory will
-still use "/different/path" as the root of the work tree and can cause
-great confusion to the users.
+	the current working directory is regarded as the top directory
+	of your working tree.
 
 core.logAllRefUpdates::
 	Enable the reflog. Updates to a ref <ref> is logged to the file
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] git.txt: correct where --work-tree path is relative to
  2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
                   ` (5 preceding siblings ...)
  2010-11-11 14:20 ` [PATCH 6/7] Revert "Documentation: always respect core.worktree if set" Nguyễn Thái Ngọc Duy
@ 2010-11-11 14:20 ` Nguyễn Thái Ngọc Duy
  6 siblings, 0 replies; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2010-11-11 14:20 UTC (permalink / raw)
  To: git, Junio C Hamano; +Cc: Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index b46c6f6..971c52a 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -284,7 +284,7 @@ help ...`.
 	This can also be controlled by setting the GIT_WORK_TREE
 	environment variable and the core.worktree configuration
 	variable. It can be an absolute path or relative path to
-	the directory specified by --git-dir or GIT_DIR.
+	current working directory.
 	Note: If --git-dir or GIT_DIR are specified but none of
 	--work-tree, GIT_WORK_TREE and core.worktree is specified,
 	the current working directory is regarded as the top directory
-- 
1.7.3.2.210.g045198

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-11 14:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 14:20 [PATCH 0/7] nd/setup fixups Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 1/7] t1020-subdirectory: test alias expansion in a subdirectory Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 2/7] setup: clean up setup_discovered_git_dir() Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 3/7] setup: rework setup_explicit_git_dir() Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 4/7] Remove all logic from get_git_work_tree() Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 5/7] t0001: test git init when run via an alias Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 6/7] Revert "Documentation: always respect core.worktree if set" Nguyễn Thái Ngọc Duy
2010-11-11 14:20 ` [PATCH 7/7] git.txt: correct where --work-tree path is relative to Nguyễn Thái Ngọc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).