These tests are created according to [1] and its following
discussions. I have yet to create tests for the last 16 cases, which
might be simpler. Tests from 8-15 are usually copy of 0-7 with some
modification. If you find bugs in 0-7, stop reading 8-15, it's just
wasting time.
The rules are bent a bit the way the code does it, specifically:
- GIT_WORK_TREE is relative to cwd, not GIT_DIR
- core.worktree is always effective regardless GIT_DIR/--git-dir
Also I assume that when cwd is outside worktree, cwd should be
unchanged (therefore prefix is NULL). This is the behavior when
GIT_DIR and GIT_WORK_TREE are set. Let's apply it to all other cases
where cwd may be outside worktree.
Adjusting the expected results is not hard. So it's up to you guys.
Once we agree on something, I can update the tests.
Also when GIT_DIR is set, .git _file_ is not recognized because
setup_explicit_git_dir() does not accept it. There are a
_lot_ of failed tests due to this. I probably should fix that,
otherwise tests #8-15 may not be very reliable.
[1] http://mid.gmane.org/20101020085859.GA13135@do
Nguyễn Thái Ngọc Duy (18):
rev-parse: add --internal-cwd and --internal-git-dir for tests
Add t1510 for setup tests
t1510: setup case #0
t1510: setup case #1
t1510: setup case #2
t1510: setup case #3
t1510: setup case #4
t1510: setup case #5
t1510: setup case #6
t1510: setup case #7
t1510: setup case #8
t1510: setup case #9
t1510: setup case #10
t1510: setup case #11
t1510: setup case #12
t1510: setup case #13
t1510: setup case #14
t1510: setup case #15
builtin/rev-parse.c | 11 +
t/t1510-repo-setup.sh | 2483 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 2494 insertions(+), 0 deletions(-)
create mode 100755 t/t1510-repo-setup.sh
--internal-cwd is obvious, no way else to expose it for testing.
--internal-git-dir is introduced because --git-dir prepares its output
suitable for scripting. For tests, it must be exactly what git stores.
---
builtin/rev-parse.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
@@ -642,6 +642,17 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)putchar('\n');continue;}+if(!strcmp(arg,"--internal-cwd")){+staticcharcwd[PATH_MAX];+if(!getcwd(cwd,PATH_MAX))+die_errno("unable to get current working directory");+puts(cwd);+continue;+}+if(!strcmp(arg,"--internal-git-dir")){+puts(get_git_dir());+continue;+}if(!strcmp(arg,"--git-dir")){constchar*gitdir=getenv(GIT_DIR_ENVIRONMENT);staticcharcwd[PATH_MAX];
@@ -0,0 +1,56 @@+#!/bin/sh++test_description='Tests of cwd/prefix/worktree/gitdir setup in all cases'++../test-lib.sh++# A few principles for repo setup:+#+# 1. GIT_DIR is relative to user's cwd. This directory is refered as+# "git_dir" below. Auto discovered repo is also "git_dir".+# --git-dir is equivalent to GIT_DIR.+#+# 2. core.worktree is relative to git_dir+#+# 3. GIT_WORK_TREE is relative to user's cwd. --work-tree is+# equivalent to GIT_WORK_TREE.+#+# 4. .git file is relative to git_dir. Note that the repo where .git+# file points to is not considered "git_dir" in the above.+#+# 5. GIT_WORK_TREE is only effective if GIT_DIR is+# set (hence "Effective GIT_WORK_TREE"+# below). Uneffective GIT_WORK_TREE should be warned.+#+# 6. Effective GIT_WORK_TREE will override core.worktree+#+# 7. During repo discovery, if "." is found a repo, it is considered a+# bare repo unless core.worktree is set+#+# 8. core.bare conflicts with core.worktree+#+# 9. Effective GIT_WORK_TREE will override core.bare+#+# 10. When user's cwd is outside worktree, cwd will remain unchanged,+# prefix be NULL.++test_repo(){+(+if[-n"$1"];thencd"$1";fi&&+gitsymbolic-refHEAD>/dev/null&&# git_dir reachability test first+gitrev-parse--internal-git-dir>result&&+gitrev-parse--show-toplevel>>result&&+gitrev-parse--internal-cwd>>result&&+gitrev-parse--show-prefix>>result&&+test_cmpexpectedresult+)+}++# Bit 0 = GIT_WORK_TREE+# Bit 1 = GIT_DIR+# Bit 2 = core.worktree+# Bit 3 = .git is a file+# Bit 4 = bare repo+# Case# = encoding of the above 5 bits++test_done
@@ -97,4 +97,46 @@ sub/ EOF'+#+# case #1+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is not set+# - core.worktree is not set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output: same as case #0 (with warnings perhaps)++test_expect_success'#1: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir11/sub1.wt1.wt/sub1/wt1/wt/sub&&+cd1&&gitinit&&cd..+'++# FIXME: check for warning that GIT_WORK_TREE is ignored+test_expect_failure'#1: at root''+cat>1/expected<<EOF&&+.git+$TRASH_DIRECTORY/1+$TRASH_DIRECTORY/1+EOF+GIT_WORK_TREE=non-existenttest_repo1+'++# FIXME: check for warning that GIT_WORK_TREE is ignored+test_expect_failure'#1: in subdir''+cat>1/sub/expected<<EOF&&+.git+$TRASH_DIRECTORY/1+$TRASH_DIRECTORY/1+sub/+EOF+GIT_WORK_TREE=non-existenttest_repo1/sub+'+ test_done
@@ -53,4 +53,48 @@ test_repo() {# Bit 4 = bare repo# Case# = encoding of the above 5 bits+#+# Case #0+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is not set+# - core.worktree is not set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# - worktree is .git's parent directory+# - cwd is at worktree root dir+# - prefix is calculated+# - git_dir is set to ".git"+# - cwd can't be outside worktree++test_expect_success'#0: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir00/sub&&+cd0&&gitinit&&cd..+'++test_expect_success'#0: at root''+cat>0/expected<<EOF&&test_repo0+.git+$TRASH_DIRECTORY/0+$TRASH_DIRECTORY/0+EOF+'++test_expect_success'#0: in subdir''+cat>0/sub/expected<<EOF&&test_repo0/sub+.git+$TRASH_DIRECTORY/0+$TRASH_DIRECTORY/0+sub/+EOF+'+ test_done
@@ -139,4 +139,67 @@ EOFGIT_WORK_TREE=non-existenttest_repo1/sub'+#+# case #2+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is set+# - core.worktree is not set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# - worktree is at original cwd+# - cwd is unchanged+# - prefix is NULL+# - git_dir is set to $GIT_DIR+# - cwd can't be outside worktree++test_expect_success'#2: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir22/sub&&+cd2&&gitinit&&cd..+'++test_expect_success'#2: at root''+cat>2/expected<<EOF&&+$TRASH_DIRECTORY/2/.git+$TRASH_DIRECTORY/2+$TRASH_DIRECTORY/2+EOF+GIT_DIR="$TRASH_DIRECTORY/2/.git"test_repo2+'++test_expect_success'#2: in subdir''+cat>2/sub/expected<<EOF&&+$TRASH_DIRECTORY/2/.git+$TRASH_DIRECTORY/2/sub+$TRASH_DIRECTORY/2/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/2/.git"test_repo2/sub+'++test_expect_success'#2: relative GIT_DIR at root''+cat>2/expected<<EOF&&+.git+$TRASH_DIRECTORY/2+$TRASH_DIRECTORY/2+EOF+GIT_DIR=.gittest_repo2+'++test_expect_success'#2: relative GIT_DIR in subdir''+cat>2/sub/expected<<EOF&&+../.git+$TRASH_DIRECTORY/2/sub+$TRASH_DIRECTORY/2/sub+EOF+GIT_DIR=../.gittest_repo2/sub+'+ test_done
@@ -202,4 +202,259 @@ EOFGIT_DIR=../.gittest_repo2/sub'+#+# case #3+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is set+# - core.worktree is not set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# - worktree is set to $GIT_WORK_TREE+# - cwd is at worktree root+# - prefix is calculated+# - git_dir is set to $GIT_DIR+# - cwd can be outside worktree++test_expect_success'#3: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir33/sub3/sub/sub3.wt3.wt/sub3/wt3/wt/sub&&+cd3&&gitinit&&cd..+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE at root''+cat>3/expected<<EOF&&+.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/3"test_repo3+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE(rel) at root''+cat>3/expected<<EOF&&+.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+EOF+GIT_DIR=.gitGIT_WORK_TREE=.test_repo3+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/3"test_repo3+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE(rel) at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE=.test_repo3+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORKTREE in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/3"test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../..test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR, GIT_WORKTREE in subdir''+cat>3/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/3"test_repo3/sub+'++test_expect_success'#3: GIT_DIR, GIT_WORKTREE(rel) in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3+$TRASH_DIRECTORY/3+sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE=../..test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=wt at root''+cat>3/expected<<EOF&&+.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/3/wt"test_repo3+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root''+cat>3/expected<<EOF&&+.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3+EOF+GIT_DIR=.gitGIT_WORK_TREE=wttest_repo3+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=wt(rel) at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE=wttest_repo3+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=wt at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/3/wt"test_repo3+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir''+cat>3/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/3/wt"test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir''+cat>3/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../wttest_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE=../../wttest_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=wt in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY/3/wt+$TRASH_DIRECTORY/3/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/3/wt"test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=.. at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo3+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/+EOF+GIT_DIR=.gitGIT_WORK_TREE=..test_repo3+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=..(rel) at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE=..test_repo3+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=.. at root''+cat>3/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo3+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../..test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE=../../../test_repo3/sub/sub+'++test_expect_success'#3: GIT_DIR, GIT_WORK_TREE=.. in subdir''+cat>3/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/3/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+3/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo3/sub/sub+'+ test_done
@@ -457,4 +457,135 @@ EOFGIT_DIR="$TRASH_DIRECTORY/3/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo3/sub/sub'+#+# case #4+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is not set+# - core.worktree is set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# - worktree is at core.worktree+# - cwd is at worktree root+# - prefix is calculated+# - git_dir is discovered+# - cwd can be outside worktree++test_expect_success'#4: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir44/sub4/sub/sub4.wt4.wt/sub4/wt4/wt/sub&&+cd4&&gitinit&&cd..+'++test_expect_success'#4: core.worktree(rel), at root''+cat>4/expected<<EOF&&+.git+$TRASH_DIRECTORY/4+$TRASH_DIRECTORY/4+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree..&&+test_repo4+'++test_expect_success'#4: core.worktree, at root''+cat>4/expected<<EOF&&+.git+$TRASH_DIRECTORY/4+$TRASH_DIRECTORY/4+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree"$TRASH_DIRECTORY/4"&&+test_repo4+'++test_expect_failure'#4: core.worktree(rel), in subdir''+cat>4/sub/sub/expected<<EOF&&+.git+$TRASH_DIRECTORY/4+$TRASH_DIRECTORY/4+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree..&&+test_repo4/sub/sub+'++test_expect_success'#4: core.worktree, in subdir''+cat>4/sub/sub/expected<<EOF&&+.git+$TRASH_DIRECTORY/4+$TRASH_DIRECTORY/4+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree"$TRASH_DIRECTORY/4"&&+test_repo4/sub/sub+'++test_expect_success'#4: core.worktree=wt(rel), at root''+cat>4/expected<<EOF&&+.git+$TRASH_DIRECTORY/4/wt+$TRASH_DIRECTORY/4+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree../wt&&+test_repo4+'++test_expect_success'#4: core.worktree=wt, at root''+cat>4/expected<<EOF&&+.git+$TRASH_DIRECTORY/4/wt+$TRASH_DIRECTORY/4+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree"$TRASH_DIRECTORY/4/wt"&&+test_repo4+'++test_expect_failure'#4: core.worktree=wt(rel), in subdir''+cat>4/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/4/wt+$TRASH_DIRECTORY/4/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree../wt&&+test_repo4/sub/sub+'++test_expect_failure'#4: core.worktree=wt, in subdir''+cat>4/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/4/wt+$TRASH_DIRECTORY/4/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree"$TRASH_DIRECTORY/4/wt"&&+test_repo4/sub/sub+'++test_expect_failure'#4: core.worktree=..(rel), at root''+cat>4/expected<<EOF&&+4/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+4/+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree../..&&+test_repo4+'++test_expect_failure'#4: core.worktree=.., at root''+cat>4/expected<<EOF&&+4/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+4/+EOF+gitconfig--file="$TRASH_DIRECTORY/4/.git/config"core.worktree"$TRASH_DIRECTORY/4"&&+test_repo4+'+ test_done
@@ -588,4 +588,139 @@ EOFtest_repo4'+#+# case #5+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is not set+# - core.worktree is set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# GIT_WORK_TREE is only effective when GIT_DIR is+# set, which is not the case. So it is the same as case #4.+#+# - worktree is at core.worktree+# - cwd is at worktree root+# - prefix is calculated+# - git_dir is discovered+# - cwd can be outside worktree++test_expect_success'#5: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir55/sub5/sub/sub5.wt5.wt/sub5/wt5/wt/sub&&+cd5&&gitinit&&cd..&&+exportGIT_WORK_TREE=non-existent+'++test_expect_failure'#5: core.worktree(rel), at root''+cat>5/expected<<EOF&&+.git+$TRASH_DIRECTORY/5+$TRASH_DIRECTORY/5+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree..&&+test_repo5+'++test_expect_failure'#5: core.worktree, at root''+cat>5/expected<<EOF&&+.git+$TRASH_DIRECTORY/5+$TRASH_DIRECTORY/5+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree"$TRASH_DIRECTORY/5"&&+test_repo5+'++test_expect_failure'#5: core.worktree(rel), in subdir''+cat>5/sub/sub/expected<<EOF&&+.git+$TRASH_DIRECTORY/5+$TRASH_DIRECTORY/5+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree..&&+test_repo5/sub/sub+'++test_expect_failure'#5: core.worktree, in subdir''+cat>5/sub/sub/expected<<EOF&&+.git+$TRASH_DIRECTORY/5+$TRASH_DIRECTORY/5+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree"$TRASH_DIRECTORY/5"&&+test_repo5/sub/sub+'++test_expect_failure'#5: core.worktree=wt(rel), at root''+cat>5/expected<<EOF&&+.git+$TRASH_DIRECTORY/5/wt+$TRASH_DIRECTORY/5+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree../wt&&+test_repo5+'++test_expect_failure'#5: core.worktree=wt, at root''+cat>5/expected<<EOF&&+.git+$TRASH_DIRECTORY/5/wt+$TRASH_DIRECTORY/5+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree"$TRASH_DIRECTORY/5/wt"&&+test_repo5+'++test_expect_failure'#5: core.worktree=wt(rel), in subdir''+cat>5/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/5/wt+$TRASH_DIRECTORY/5/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree../wt&&+test_repo5/sub/sub+'++test_expect_failure'#5: core.worktree=wt, in subdir''+cat>5/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/5/wt+$TRASH_DIRECTORY/5/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree"$TRASH_DIRECTORY/5/wt"&&+test_repo5/sub/sub+'++test_expect_failure'#5: core.worktree=..(rel), at root''+cat>5/expected<<EOF&&+5/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+5/+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree../..&&+test_repo5+'++test_expect_failure'#5: core.worktree=.., at root''+cat>5/expected<<EOF&&+5/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+5/+EOF+gitconfig--file="$TRASH_DIRECTORY/5/.git/config"core.worktree"$TRASH_DIRECTORY/5"&&+test_repo5+'+ test_done
@@ -1002,4 +1002,265 @@ EOFGIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub/sub'+#+# case #7+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is set+# - core.worktree is set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# core.worktree is overridden by GIT_WORK_TREE, so this is the same as+# case #3.+#+# - worktree is at $GIT_WORK_TREE+# - cwd is at worktree root+# - prefix is calculated+# - git_dir is at $GIT_DIR+# - cwd can be outside worktree++test_expect_success'#7: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir77/sub7/sub/sub7.wt7.wt/sub7/wt7/wt/sub&&+cd7&&+gitinit&&+gitconfigcore.worktreenon-existent&&+cd..+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE at root''+cat>7/expected<<EOF&&+.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/7"test_repo7+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE(rel) at root''+cat>7/expected<<EOF&&+.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+EOF+GIT_DIR=.gitGIT_WORK_TREE=.test_repo7+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/7"test_repo7+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE(rel) at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE=.test_repo7+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORKTREE in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/7"test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../..test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR, GIT_WORKTREE in subdir''+cat>7/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/7"test_repo7/sub+'++test_expect_success'#7: GIT_DIR, GIT_WORKTREE(rel) in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7+$TRASH_DIRECTORY/7+sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE=../..test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=wt at root''+cat>7/expected<<EOF&&+.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/7/wt"test_repo7+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root''+cat>7/expected<<EOF&&+.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7+EOF+GIT_DIR=.gitGIT_WORK_TREE=wttest_repo7+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=wt(rel) at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE=wttest_repo7+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=wt at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/7/wt"test_repo7+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir''+cat>7/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/7/wt"test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir''+cat>7/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../wttest_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE=../../wttest_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=wt in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY/7/wt+$TRASH_DIRECTORY/7/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/7/wt"test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=.. at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo7+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/+EOF+GIT_DIR=.gitGIT_WORK_TREE=..test_repo7+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=..(rel) at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE=..test_repo7+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=.. at root''+cat>7/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo7+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../..test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE=../../../test_repo7/sub/sub+'++test_expect_success'#7: GIT_DIR, GIT_WORK_TREE=.. in subdir''+cat>7/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/7/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+7/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo7/sub/sub+'+ test_done
@@ -723,4 +723,283 @@ EOFtest_repo5'+#+# case #6+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is set+# - core.worktree is set+# - .git is a directory+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# - worktree is at core.worktree+# - cwd is at worktree root+# - prefix is calculated+# - git_dir is at $GIT_DIR+# - cwd can be outside worktree++test_expect_success'#6: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir66/sub6/sub/sub6.wt6.wt/sub6/wt6/wt/sub&&+cd6&&gitinit&&cd..+'++test_expect_success'#6: GIT_DIR(rel), GIT_WORK_TREE at root''+cat>6/expected<<EOF&&+.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6"&&+GIT_DIR=.gittest_repo6+'++test_expect_success'#6: GIT_DIR(rel), GIT_WORK_TREE(rel) at root''+cat>6/expected<<EOF&&+.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree..&&+GIT_DIR=.gittest_repo6+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE at root''+cat>6/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6"&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE(rel) at root''+cat>6/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree..&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6+'++test_expect_failure'#6: GIT_DIR(rel), GIT_WORKTREE in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6"&&+GIT_DIR=../../.gittest_repo6/sub/sub+'++test_expect_failure'#6: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree..&&+GIT_DIR=../../.gittest_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR, GIT_WORKTREE in subdir''+cat>6/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6"&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub+'++test_expect_success'#6: GIT_DIR, GIT_WORKTREE(rel) in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6+$TRASH_DIRECTORY/6+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree..&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR(rel), GIT_WORK_TREE=wt at root''+cat>6/expected<<EOF&&+.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6/wt"&&+GIT_DIR=.gittest_repo6+'++test_expect_success'#6: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root''+cat>6/expected<<EOF&&+.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../wt&&+GIT_DIR=.gittest_repo6+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=wt(rel) at root''+cat>6/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../wt&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=wt at root''+cat>6/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6/wt"&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6+'++test_expect_success'#6: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir''+cat>6/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6/wt"&&+GIT_DIR=../../.gittest_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir''+cat>6/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../wt&&+GIT_DIR=../../.gittest_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../wt&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=wt in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY/6/wt+$TRASH_DIRECTORY/6/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY/6/wt"&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub/sub+'++test_expect_failure'#6: GIT_DIR(rel), GIT_WORK_TREE=.. at root''+cat>6/expected<<EOF&&+6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR=.gittest_repo6+'++test_expect_failure'#6: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root''+cat>6/expected<<EOF&&+6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../../&&+GIT_DIR=.gittest_repo6+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=..(rel) at root''+cat>6/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../../&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=.. at root''+cat>6/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6+'++test_expect_failure'#6: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir''+cat>6/sub/sub/expected<<EOF&&+6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR=../../.gittest_repo6/sub/sub+'++test_expect_failure'#6: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir''+cat>6/sub/sub/expected<<EOF&&+6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../..&&+GIT_DIR=../../.gittest_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree../..&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub/sub+'++test_expect_success'#6: GIT_DIR, GIT_WORK_TREE=.. in subdir''+cat>6/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/6/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+6/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/6/.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR="$TRASH_DIRECTORY/6/.git"test_repo6/sub/sub+'+ test_done
@@ -1263,4 +1263,56 @@ EOFGIT_DIR="$TRASH_DIRECTORY/7/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo7/sub/sub'+#+# case #8+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is not set+# - core.worktree is not set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #1 except that git_dir is set by .git file+#+# - worktree is at .git file's parent directory+# - cwd is at worktree root+# - prefix is calculated+# - git_dir is set to where .git points to+# - cwd can't be outside worktree++test_expect_success'#8: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir88/sub&&+cd8&&+gitinit&&+mv.git../8.git&&+echogitdir:../8.git>.git&&+cd..+'++test_expect_success'#8: at root''+cat>8/expected<<EOF&&+$TRASH_DIRECTORY/8.git+$TRASH_DIRECTORY/8+$TRASH_DIRECTORY/8+EOF+test_repo8+'++test_expect_success'#8: in subdir''+cat>8/sub/expected<<EOF&&+$TRASH_DIRECTORY/8.git+$TRASH_DIRECTORY/8+$TRASH_DIRECTORY/8+sub/+EOF+test_repo8/sub+'+ test_done
@@ -1315,4 +1315,52 @@ EOFtest_repo8/sub'+#+# case #9+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is not set+# - core.worktree is not set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #1 except that git_dir is set by .git file++test_expect_success'#9: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir99/sub9.wt9.wt/sub9/wt9/wt/sub&&+cd9&&+gitinit&&+mv.git../9.git&&+echogitdir:../9.git>.git&&+cd..+'++# FIXME: check for warning that GIT_WORK_TREE is ignored+test_expect_failure'#9: at root''+cat>9/expected<<EOF&&+$TRASH_DIRECTORY/9.git+$TRASH_DIRECTORY/9+$TRASH_DIRECTORY/9+EOF+GIT_WORK_TREE=non-existenttest_repo9+'++# FIXME: check for warning that GIT_WORK_TREE is ignored+test_expect_failure'#9: in subdir''+cat>9/sub/expected<<EOF&&+$TRASH_DIRECTORY/9.git+$TRASH_DIRECTORY/9+$TRASH_DIRECTORY/9+sub/+EOF+GIT_WORK_TREE=non-existenttest_repo9/sub+'+ test_done
@@ -1363,4 +1363,67 @@ EOFGIT_WORK_TREE=non-existenttest_repo9/sub'+#+# case #10+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is set+# - core.worktree is not set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #2 except that git_dir is set by .git file++test_expect_success'#10: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir1010/sub&&+cd10&&+gitinit&&+mv.git../10.git&&+echogitdir:../10.git>.git&&+cd..+'++test_expect_failure'#10: at root''+cat>10/expected<<EOF&&+$TRASH_DIRECTORY/10.git+$TRASH_DIRECTORY/10+$TRASH_DIRECTORY/10+EOF+GIT_DIR="$TRASH_DIRECTORY/10/.git"test_repo10+'++test_expect_failure'#10: in subdir''+cat>10/sub/expected<<EOF&&+$TRASH_DIRECTORY/10.git+$TRASH_DIRECTORY/10/sub+$TRASH_DIRECTORY/10/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/10/.git"test_repo10/sub+'++test_expect_failure'#10: relative GIT_DIR at root''+cat>10/expected<<EOF&&+$TRASH_DIRECTORY/10.git+$TRASH_DIRECTORY/10+$TRASH_DIRECTORY/10+EOF+GIT_DIR=.gittest_repo10+'++test_expect_failure'#10: relative GIT_DIR in subdir''+cat>10/sub/expected<<EOF&&+$TRASH_DIRECTORY/10.git+$TRASH_DIRECTORY/10/sub+$TRASH_DIRECTORY/10/sub+EOF+GIT_DIR=../.gittest_repo10/sub+'+ test_done
@@ -1426,4 +1426,259 @@ EOFGIT_DIR=../.gittest_repo10/sub'+#+# case #11+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is set+# - core.worktree is not set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #3 except that git_dir is set by .git file++test_expect_success'#11: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir1111/sub11/sub/sub11.wt11.wt/sub11/wt11/wt/sub&&+cd11&&+gitinit&&+mv.git../11.git&&+echogitdir:../11.git>.git&&+cd..+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/11"test_repo11+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE(rel) at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+EOF+GIT_DIR=.gitGIT_WORK_TREE=.test_repo11+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/11"test_repo11+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE(rel) at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE=.test_repo11+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORKTREE in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/11"test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../..test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR, GIT_WORKTREE in subdir''+cat>11/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/11"test_repo11/sub+'++test_expect_failure'#11: GIT_DIR, GIT_WORKTREE(rel) in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11+$TRASH_DIRECTORY/11+sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE=../..test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=wt at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/11/wt"test_repo11+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11+EOF+GIT_DIR=.gitGIT_WORK_TREE=wttest_repo11+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=wt(rel) at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE=wttest_repo11+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=wt at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/11/wt"test_repo11+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/11/wt"test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../wttest_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE=../../wttest_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=wt in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY/11/wt+$TRASH_DIRECTORY/11/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/11/wt"test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=.. at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo11+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/+EOF+GIT_DIR=.gitGIT_WORK_TREE=..test_repo11+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=..(rel) at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE=..test_repo11+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=.. at root''+cat>11/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo11+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../..test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE=../../../test_repo11/sub/sub+'++test_expect_failure'#11: GIT_DIR, GIT_WORK_TREE=.. in subdir''+cat>11/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/11.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+11/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo11/sub/sub+'+ test_done
@@ -1681,4 +1681,136 @@ EOFGIT_DIR="$TRASH_DIRECTORY/11/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo11/sub/sub'+#+# case #12+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is not set+# - core.worktree is set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #4 except that git_dir is set by .git file+++test_expect_success'#12: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir1212/sub12/sub/sub12.wt12.wt/sub12/wt12/wt/sub&&+cd12&&+gitinit&&+mv.git../12.git&&+echogitdir:../12.git>.git&&+cd..+'++test_expect_failure'#12: core.worktree(rel), at root''+cat>12/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12+$TRASH_DIRECTORY/12+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree..&&+test_repo12+'++test_expect_success'#12: core.worktree, at root''+cat>12/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12+$TRASH_DIRECTORY/12+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree"$TRASH_DIRECTORY/12"&&+test_repo12+'++test_expect_failure'#12: core.worktree(rel), in subdir''+cat>12/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12+$TRASH_DIRECTORY/12+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree..&&+test_repo12/sub/sub+'++test_expect_success'#12: core.worktree, in subdir''+cat>12/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12+$TRASH_DIRECTORY/12+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree"$TRASH_DIRECTORY/12"&&+test_repo12/sub/sub+'++test_expect_failure'#12: core.worktree=wt(rel), at root''+cat>12/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12/wt+$TRASH_DIRECTORY/12+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree../wt&&+test_repo12+'++test_expect_success'#12: core.worktree=wt, at root''+cat>12/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12/wt+$TRASH_DIRECTORY/12+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree"$TRASH_DIRECTORY/12/wt"&&+test_repo12+'++test_expect_failure'#12: core.worktree=wt(rel), in subdir''+cat>12/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12/wt+$TRASH_DIRECTORY/12/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree../wt&&+test_repo12/sub/sub+'++test_expect_success'#12: core.worktree=wt, in subdir''+cat>12/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY/12/wt+$TRASH_DIRECTORY/12/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree"$TRASH_DIRECTORY/12/wt"&&+test_repo12/sub/sub+'++test_expect_failure'#12: core.worktree=..(rel), at root''+cat>12/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+12/+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree../..&&+test_repo12+'++test_expect_failure'#12: core.worktree=.., at root''+cat>12/expected<<EOF&&+$TRASH_DIRECTORY/12.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+12/+EOF+gitconfig--file="$TRASH_DIRECTORY/12.git/config"core.worktree"$TRASH_DIRECTORY/12"&&+test_repo12+'+ test_done
@@ -1813,4 +1813,136 @@ EOFtest_repo12'+#+# case #13+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is not set+# - core.worktree is set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #5 except that git_dir is set by .git file++test_expect_success'#13: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir1313/sub13/sub/sub13.wt13.wt/sub13/wt13/wt/sub&&+cd13&&+gitinit&&+mv.git../13.git&&+echogitdir:../13.git>.git&&+cd..&&+exportGIT_WORK_TREE=non-existent+'++test_expect_failure'#13: core.worktree(rel), at root''+cat>13/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13+$TRASH_DIRECTORY/13+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree..&&+test_repo13+'++test_expect_failure'#13: core.worktree, at root''+cat>13/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13+$TRASH_DIRECTORY/13+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree"$TRASH_DIRECTORY/13"&&+test_repo13+'++test_expect_failure'#13: core.worktree(rel), in subdir''+cat>13/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13+$TRASH_DIRECTORY/13+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree..&&+test_repo13/sub/sub+'++test_expect_failure'#13: core.worktree, in subdir''+cat>13/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13+$TRASH_DIRECTORY/13+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree"$TRASH_DIRECTORY/13"&&+test_repo13/sub/sub+'++test_expect_failure'#13: core.worktree=wt(rel), at root''+cat>13/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13/wt+$TRASH_DIRECTORY/13+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree../wt&&+test_repo13+'++test_expect_failure'#13: core.worktree=wt, at root''+cat>13/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13/wt+$TRASH_DIRECTORY/13+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree"$TRASH_DIRECTORY/13/wt"&&+test_repo13+'++test_expect_failure'#13: core.worktree=wt(rel), in subdir''+cat>13/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13/wt+$TRASH_DIRECTORY/13/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree../wt&&+test_repo13/sub/sub+'++test_expect_failure'#13: core.worktree=wt, in subdir''+cat>13/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY/13/wt+$TRASH_DIRECTORY/13/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree"$TRASH_DIRECTORY/13/wt"&&+test_repo13/sub/sub+'++test_expect_failure'#13: core.worktree=..(rel), at root''+cat>13/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+13/+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree../..&&+test_repo13+'++test_expect_failure'#13: core.worktree=.., at root''+cat>13/expected<<EOF&&+$TRASH_DIRECTORY/13.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+13/+EOF+gitconfig--file="$TRASH_DIRECTORY/13.git/config"core.worktree"$TRASH_DIRECTORY/13"&&+test_repo13+'+ test_done
@@ -1945,4 +1945,283 @@ EOFtest_repo13'+#+# case #14+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is not set+# - GIT_DIR is set+# - core.worktree is set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #6 except that git_dir is set by .git file++test_expect_success'#14: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir1414/sub14/sub/sub14.wt14.wt/sub14/wt14/wt/sub&&+cd14&&+gitinit&&+mv.git../14.git&&+echogitdir:../14.git>.git&&+cd..+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE at root''+cat>14/expected<<EOF&&+.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14"&&+GIT_DIR=.gittest_repo14+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE(rel) at root''+cat>14/expected<<EOF&&+.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree..&&+GIT_DIR=.gittest_repo14+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE at root''+cat>14/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14"&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE(rel) at root''+cat>14/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree..&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORKTREE in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14"&&+GIT_DIR=../../.gittest_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree..&&+GIT_DIR=../../.gittest_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR, GIT_WORKTREE in subdir''+cat>14/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14"&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub+'++test_expect_failure'#14: GIT_DIR, GIT_WORKTREE(rel) in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14+$TRASH_DIRECTORY/14+sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree..&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=wt at root''+cat>14/expected<<EOF&&+.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14/wt"&&+GIT_DIR=.gittest_repo14+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root''+cat>14/expected<<EOF&&+.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../wt&&+GIT_DIR=.gittest_repo14+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=wt(rel) at root''+cat>14/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../wt&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=wt at root''+cat>14/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14/wt"&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir''+cat>14/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14/wt"&&+GIT_DIR=../../.gittest_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir''+cat>14/sub/sub/expected<<EOF&&+../../.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../wt&&+GIT_DIR=../../.gittest_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../wt&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=wt in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY/14/wt+$TRASH_DIRECTORY/14/sub/sub+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY/14/wt"&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=.. at root''+cat>14/expected<<EOF&&+14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR=.gittest_repo14+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root''+cat>14/expected<<EOF&&+14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../../&&+GIT_DIR=.gittest_repo14+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=..(rel) at root''+cat>14/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../../&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=.. at root''+cat>14/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir''+cat>14/sub/sub/expected<<EOF&&+14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR=../../.gittest_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir''+cat>14/sub/sub/expected<<EOF&&+14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../..&&+GIT_DIR=../../.gittest_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree../..&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub/sub+'++test_expect_failure'#14: GIT_DIR, GIT_WORK_TREE=.. in subdir''+cat>14/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/14/.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+14/sub/sub/+EOF+gitconfig--file="$TRASH_DIRECTORY/14.git/config"core.worktree"$TRASH_DIRECTORY"&&+GIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub/sub+'+ test_done
@@ -2224,4 +2224,260 @@ EOFGIT_DIR="$TRASH_DIRECTORY/14/.git"test_repo14/sub/sub'+#+# case #15+#+############################################################+#+# Input:+#+# - GIT_WORK_TREE is set+# - GIT_DIR is set+# - core.worktree is set+# - .git is a file+# - core.bare is not set, cwd is outside .git+#+# Output:+#+# same as case #7 except that git_dir is set by .git file++test_expect_success'#15: setup''+unsetGIT_DIRGIT_WORK_TREE&&+mkdir1515/sub15/sub/sub15.wt15.wt/sub15/wt15/wt/sub&&+cd15&&+gitinit&&+gitconfigcore.worktreenon-existent&&+mv.git../15.git&&+echogitdir:../15.git>.git&&+cd..+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/15"test_repo15+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE(rel) at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+EOF+GIT_DIR=.gitGIT_WORK_TREE=.test_repo15+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/15"test_repo15+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE(rel) at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE=.test_repo15+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORKTREE in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/15"test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORKTREE(rel) in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../..test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR, GIT_WORKTREE in subdir''+cat>15/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/15"test_repo15/sub+'++test_expect_failure'#15: GIT_DIR, GIT_WORKTREE(rel) in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15+$TRASH_DIRECTORY/15+sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE=../..test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=wt at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY/15/wt"test_repo15+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15+EOF+GIT_DIR=.gitGIT_WORK_TREE=wttest_repo15+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=wt(rel) at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE=wttest_repo15+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=wt at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/15/wt"test_repo15+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=wt in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY/15/wt"test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=wt(rel) in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15/sub/sub+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../wttest_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=wt(rel) in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE=../../wttest_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=wt in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY/15/wt+$TRASH_DIRECTORY/15/sub/sub+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE="$TRASH_DIRECTORY/15/wt"test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=.. at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/+EOF+GIT_DIR=.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo15+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/+EOF+GIT_DIR=.gitGIT_WORK_TREE=..test_repo15+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=..(rel) at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE=..test_repo15+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=.. at root''+cat>15/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo15+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=.. in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE="$TRASH_DIRECTORY"test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR(rel), GIT_WORK_TREE=..(rel) in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/sub/sub/+EOF+GIT_DIR=../../.gitGIT_WORK_TREE=../../..test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=..(rel) in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE=../../../test_repo15/sub/sub+'++test_expect_failure'#15: GIT_DIR, GIT_WORK_TREE=.. in subdir''+cat>15/sub/sub/expected<<EOF&&+$TRASH_DIRECTORY/15.git+$TRASH_DIRECTORY+$TRASH_DIRECTORY+15/sub/sub/+EOF+GIT_DIR="$TRASH_DIRECTORY/15/.git"GIT_WORK_TREE="$TRASH_DIRECTORY"test_repo15/sub/sub+'+ test_done
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:52
Nguyễn Thái Ngọc Duy wrote:
--internal-cwd is obvious, no way else to expose it for testing.
--internal-git-dir is introduced because --git-dir prepares its output
suitable for scripting. For tests, it must be exactly what git stores.
Hmm. Forget this is used in tests, would it make sense to do this
with trace_printf, at the end of setup, as in your earlier patch?
I think it might: just like the exec: lines provide context about what
command is being traced, such trace: cwd: lines would make it clearer
what paths that are being output might be referring to.
Returning to the topic of tests, is it possible to get at these
variables using an external command that is run by git? pre-commit
hook, maybe. Testing of other symptoms is also possible, as in
Frédéric's example.
--internal-cwd is obvious, no way else to expose it for testing.
--internal-git-dir is introduced because --git-dir prepares its output
suitable for scripting. For tests, it must be exactly what git stores.
Hmm. Forget this is used in tests, would it make sense to do this
with trace_printf, at the end of setup, as in your earlier patch?
trace_printf surely does. But "the end of setup" is unclear. As of
now, setup ends when setup_* function _and_ setup_git_env() are
called. There are cases that setup_* finishes without calling
setup_git_env(), or setup_git_env() is called way before setup_* is
finished.
I think it might: just like the exec: lines provide context about what
command is being traced, such trace: cwd: lines would make it clearer
what paths that are being output might be referring to.
Also prefix them all with "setup:", something like
setup: git_dir: ../.git
setup: work_tree: /my/git/worktree
setup: cwd: /my/git/worktree
setup: prefix: sub/
would be easy to be grepped from GIT_TRACE, to read and to test_cmp.
Returning to the topic of tests, is it possible to get at these
variables using an external command that is run by git? pre-commit
hook, maybe. Testing of other symptoms is also possible, as in
Frédéric's example.
Why do hooks need these? git_dir, prefix are already accessible via
--git-dir, --show-prefix, --show-toplevel. Current cwd can be
determined with --is-inside-work-tree: if it returns true, current cwd
is worktree root, otherwise it is original cwd.
--
Duy
From: Jakub Narebski <hidden> Date: 2016-06-15 22:49:52
Nguyen Thai Ngoc Duy [off-list ref] writes:
2010/10/24 Jonathan Nieder [off-list ref]:
quoted
I think it might: just like the exec: lines provide context about what
command is being traced, such trace: cwd: lines would make it clearer
what paths that are being output might be referring to.
Also prefix them all with "setup:", something like
setup: git_dir: ../.git
setup: work_tree: /my/git/worktree
setup: cwd: /my/git/worktree
setup: prefix: sub/
I guess that those paths would be c-quoted, if necessary (trailing
space, embedded newline, quotes, etc.)?
--
Jakub Narebski
Poland
ShadeHawk on #git
On Mon, Oct 25, 2010 at 5:15 PM, Jakub Narebski [off-list ref] wrote:
Nguyen Thai Ngoc Duy [off-list ref] writes:
quoted
2010/10/24 Jonathan Nieder [off-list ref]:
quoted
quoted
I think it might: just like the exec: lines provide context about what
command is being traced, such trace: cwd: lines would make it clearer
what paths that are being output might be referring to.
Also prefix them all with "setup:", something like
setup: git_dir: ../.git
setup: work_tree: /my/git/worktree
setup: cwd: /my/git/worktree
setup: prefix: sub/
I guess that those paths would be c-quoted, if necessary (trailing
space, embedded newline, quotes, etc.)?
For the sake of grep (because '\n' may break lines), yes.
--
Duy