(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: { (DQ <'Tests of cwd/prefix/worktree/gitdir setup in all cases\n'> <'\n'> <'A few rules for repo setup:\n'> <'\n'> <'1. GIT_DIR is relative to user\'s cwd. --git-dir is equivalent to\n'> <' GIT_DIR.\n'> <'\n'> <'2. .git file is relative to parent directory. .git file is basically\n'> <' symlink in disguise. The directory where .git file points to will\n'> <' become new git_dir.\n'> <'\n'> <'3. core.worktree is relative to git_dir.\n'> <'\n'> <'4. GIT_WORK_TREE is relative to user\'s cwd. --work-tree is\n'> <' equivalent to GIT_WORK_TREE.\n'> <'\n'> <'5. GIT_WORK_TREE/core.worktree was originally meant to work only if\n'> <' GIT_DIR is set, but earlier git didn\'t enforce it, and some scripts\n'> <' depend on the implementation that happened to first discover .git by\n'> <' going up from the users '> ($ Id.VSub_DollarName cwd) <' and then using the specified working tree\n'> <' that may or may not have any relation to where .git was found in. This\n'> <' historical behaviour must be kept.\n'> <'\n'> <'6. Effective GIT_WORK_TREE overrides core.worktree and core.bare\n'> <'\n'> <'7. Effective core.worktree conflicts with core.bare\n'> <'\n'> <'8. If GIT_DIR is set but neither worktree nor bare setting is given,\n'> <' original cwd becomes worktree.\n'> <'\n'> <'9. If .git discovery is done inside a repo, the repo becomes a bare\n'> <' repo. .git discovery is performed if GIT_DIR is not set.\n'> <'\n'> <'10. If no worktree is available, cwd remains unchanged, prefix is\n'> <' NULL.\n'> <'\n'> <'11. When user\'s cwd is outside worktree, cwd remains unchanged,\n'> <' prefix is NULL.\n'> ) } spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'here='> name:here) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) } spids: [53] ) ] redirects: [] ) (command.ShFunction name: test_repo body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ ($ Id.VSub_Number 1))}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<test>} {<-n>} {(DQ ($ Id.VSub_Number 2))})] ) action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'GIT_DIR='> name: GIT_DIR ) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number 2))} spids: [93] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) ] spids: [79 90] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<test>} {<-n>} {(DQ ($ Id.VSub_Number 3))})] ) action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'GIT_WORK_TREE='> name: GIT_WORK_TREE ) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number 3))} spids: [125] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) ] spids: [111 122] ) ] else_action: [] redirects: [] ) (C {<rm>} {<-f>} {<trace>}) (command.Simple words: [{<git>} {<symbolic-ref>} {<HEAD>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] more_env: [ (env_pair name: GIT_TRACE_SETUP val: { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/trace'> ) } spids: [152] ) ] do_fork: T ) (command.Simple words: [{<grep>} {(SQ <'^setup: '>)} {<trace>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<result>} ) ] more_env: [] do_fork: T ) (C {<test_cmp>} {<expected>} {<result>}) ] ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: maybe_config body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'file='> name:file) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [206] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'var='> name:var) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [209] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'value='> name:value) op: assign_op.Equal rhs: {($ Id.VSub_Number 3)} spids: [212] ) ] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<test>} {(DQ ($ Id.VSub_DollarName value))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<unset>} ) ] ) action: [ (C {<git>} {<config>} {<--file> <Id.Lit_Equals '='> (DQ ($ Id.VSub_DollarName file))} {(DQ ($ Id.VSub_DollarName var))} {(DQ ($ Id.VSub_DollarName value))} ) ] spids: [218 232] ) ] else_action: [] redirects: [] ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: setup_repo body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'name='> name:name) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [267] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'worktreecfg='> name:worktreecfg) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [270] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'gitfile='> name:gitfile) op: assign_op.Equal rhs: {($ Id.VSub_Number 3)} spids: [273] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'barecfg='> name:barecfg) op: assign_op.Equal rhs: {($ Id.VSub_Number 4)} spids: [276] ) ] redirects: [] ) (C {<sane_unset>} {<GIT_DIR>} {<GIT_WORK_TREE>}) (C {<git>} {<init>} {(DQ ($ Id.VSub_DollarName name))}) (C {<maybe_config>} {(DQ ($ Id.VSub_DollarName name) <'/.git/config'>)} {<core.worktree>} {(DQ ($ Id.VSub_DollarName worktreecfg))} ) (C {<maybe_config>} {(DQ ($ Id.VSub_DollarName name) <'/.git/config'>)} {<core.bare>} {(DQ ($ Id.VSub_DollarName barecfg))} ) (C {<mkdir>} {<-p>} {(DQ ($ Id.VSub_DollarName name) <'/sub/sub'>)}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<test>} { (DQ (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name gitfile> var_name: gitfile suffix_op: (suffix_op.Unary op: <Id.VTest_ColonPlus _> arg_word: {<set>} ) right: <Id.Right_DollarBrace '}'> ) ) } ) ] ) action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<mv>} {(DQ ($ Id.VSub_DollarName name) <'/.git'>)} {(DQ ($ Id.VSub_DollarName name) <.git>)} ) (command.Simple words: [{<echo>} {(DQ <'gitdir: ../'> ($ Id.VSub_DollarName name) <.git>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName name) <'/.git'>)} ) ] more_env: [] do_fork: T ) ] ) ] spids: [348 361] ) ] else_action: [] redirects: [] ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: maybe_set body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'var='> name:var) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [407] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'value='> name:value) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [410] ) ] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<test>} {(DQ ($ Id.VSub_DollarName value))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {<unset>} ) ] ) action: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<eval>} { (DQ ($ Id.VSub_DollarName var) <'='> (word_part.EscapedLiteral token: <Id.Lit_EscapedChar '\\$'> ch: '$' ) <value> ) } ) (C {<export>} {($ Id.VSub_DollarName var)}) ] ) ] spids: [416 430] ) ] else_action: [] redirects: [] ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: setup_env body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'worktreenv='> name:worktreenv) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [463] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'gitdirenv='> name:gitdirenv) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [466] ) ] redirects: [] ) (C {<sane_unset>} {<GIT_DIR>} {<GIT_WORK_TREE>}) (C {<maybe_set>} {<GIT_DIR>} {(DQ ($ Id.VSub_DollarName gitdirenv))}) (C {<maybe_set>} {<GIT_WORK_TREE>} {(DQ ($ Id.VSub_DollarName worktreeenv))}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: expect body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_Number 1) <'/expected'>)} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 538 stdin_parts: [ <'setup: git_dir: '> ($ Id.VSub_Number 2) <'\n'> <'setup: git_common_dir: '> ($ Id.VSub_Number 2) <'\n'> <'setup: worktree: '> ($ Id.VSub_Number 3) <'\n'> <'setup: cwd: '> ($ Id.VSub_Number 4) <'\n'> <'setup: prefix: '> ($ Id.VSub_Number 5) <'\n'> ] ) ) ] more_env: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: try_case body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'name='> name:name) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [550] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'worktreeenv='> name:worktreeenv) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [553] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'gitdirenv='> name:gitdirenv) op: assign_op.Equal rhs: {($ Id.VSub_Number 3)} spids: [556] ) ] redirects: [] ) (C {<setup_env>} {(DQ ($ Id.VSub_DollarName worktreeenv))} {(DQ ($ Id.VSub_DollarName gitdirenv))} ) (C {<expect>} {(DQ ($ Id.VSub_DollarName name))} {(DQ ($ Id.VSub_Number 4))} {(DQ ($ Id.VSub_Number 5))} {(DQ ($ Id.VSub_Number 6))} {(DQ ($ Id.VSub_Number 7))} ) (C {<test_repo>} {(DQ ($ Id.VSub_DollarName name))}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: run_wt_tests body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'N='> name:N) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [617] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'gitfile='> name:gitfile) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [620] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'absgit='> name:absgit) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName here) <'/'> ($ Id.VSub_DollarName N) <'/.git'>)} spids: [625] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dotgit='> name:dotgit) op: assign_op.Equal rhs: {<.git>} spids: [634] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dotdotgit='> name:dotdotgit) op: assign_op.Equal rhs: {<'../../.git'>} spids: [638] ) ] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<test>} {(DQ ($ Id.VSub_DollarName gitfile))})] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'absgit='> name:absgit) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_DollarName here) <'/'> ($ Id.VSub_DollarName N) <.git>)} spids: [655] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dotgit='> name:dotgit) op: assign_op.Equal rhs: {($ Id.VSub_DollarName absgit)} spids: [664] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'dotdotgit='> name:dotdotgit) op: assign_op.Equal rhs: {($ Id.VSub_DollarName absgit)} spids: [667] ) ] redirects: [] ) ] spids: [643 652] ) ] else_action: [] redirects: [] ) (C {<test_expect_success>} { (DQ <'#'> ($ Id.VSub_DollarName N) <': explicit GIT_WORK_TREE and GIT_DIR at toplevel'>) } { (SQ <'\n'> <'\t\ttry_case $N "$here/$N" .git \\\n'> <'\t\t\t"$dotgit" "$here/$N" "$here/$N" "(null)" &&\n'> <'\t\ttry_case $N . .git \\\n'> <'\t\t\t"$dotgit" "$here/$N" "$here/$N" "(null)" &&\n'> <'\t\ttry_case $N "$here/$N" "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N" "$here/$N" "(null)" &&\n'> <'\t\ttry_case $N . "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N" "$here/$N" "(null)"\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'#'> ($ Id.VSub_DollarName N) <': explicit GIT_WORK_TREE and GIT_DIR in subdir'>)} { (SQ <'\n'> <'\t\ttry_case $N/sub/sub "$here/$N" ../../.git \\\n'> <'\t\t\t"$absgit" "$here/$N" "$here/$N" sub/sub/ &&\n'> <'\t\ttry_case $N/sub/sub ../.. ../../.git \\\n'> <'\t\t\t"$absgit" "$here/$N" "$here/$N" sub/sub/ &&\n'> <'\t\ttry_case $N/sub/sub "$here/$N" "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N" "$here/$N" sub/sub/ &&\n'> <'\t\ttry_case $N/sub/sub ../.. "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N" "$here/$N" sub/sub/\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ <'#'> ($ Id.VSub_DollarName N) <': explicit GIT_WORK_TREE from parent of worktree'>) } { (SQ <'\n'> <'\t\ttry_case $N "$here/$N/wt" .git \\\n'> <'\t\t\t"$dotgit" "$here/$N/wt" "$here/$N" "(null)" &&\n'> <'\t\ttry_case $N wt .git \\\n'> <'\t\t\t"$dotgit" "$here/$N/wt" "$here/$N" "(null)" &&\n'> <'\t\ttry_case $N wt "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N/wt" "$here/$N" "(null)" &&\n'> <'\t\ttry_case $N "$here/$N/wt" "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N/wt" "$here/$N" "(null)"\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ <'#'> ($ Id.VSub_DollarName N) <': explicit GIT_WORK_TREE from nephew of worktree'>) } { (SQ <'\n'> <'\t\ttry_case $N/sub/sub "$here/$N/wt" ../../.git \\\n'> <'\t\t\t"$dotdotgit" "$here/$N/wt" "$here/$N/sub/sub" "(null)" &&\n'> <'\t\ttry_case $N/sub/sub ../../wt ../../.git \\\n'> <'\t\t\t"$dotdotgit" "$here/$N/wt" "$here/$N/sub/sub" "(null)" &&\n'> <'\t\ttry_case $N/sub/sub ../../wt "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N/wt" "$here/$N/sub/sub" "(null)" &&\n'> <'\t\ttry_case $N/sub/sub "$here/$N/wt" "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here/$N/wt" "$here/$N/sub/sub" "(null)"\n'> <'\t'> ) } ) (C {<test_expect_success>} {(DQ <'#'> ($ Id.VSub_DollarName N) <': chdir_to_toplevel uses worktree, not git dir'>)} { (SQ <'\n'> <'\t\ttry_case $N "$here" .git \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/ &&\n'> <'\t\ttry_case $N .. .git \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/ &&\n'> <'\t\ttry_case $N .. "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/ &&\n'> <'\t\ttry_case $N "$here" "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/\n'> <'\t'> ) } ) (C {<test_expect_success>} { (DQ <'#'> ($ Id.VSub_DollarName N) <': chdir_to_toplevel uses worktree (from subdir)'>) } { (SQ <'\n'> <'\t\ttry_case $N/sub/sub "$here" ../../.git \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/sub/sub/ &&\n'> <'\t\ttry_case $N/sub/sub ../../.. ../../.git \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/sub/sub/ &&\n'> <'\t\ttry_case $N/sub/sub ../../../ "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/sub/sub/ &&\n'> <'\t\ttry_case $N/sub/sub "$here" "$here/$N/.git" \\\n'> <'\t\t\t"$absgit" "$here" "$here" $N/sub/sub/\n'> <'\t'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: try_repo body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'name='> name:name) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [831] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'worktreeenv='> name:worktreeenv) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [834] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'gitdirenv='> name:gitdirenv) op: assign_op.Equal rhs: {($ Id.VSub_Number 3)} spids: [837] ) ] redirects: [] ) (C {<setup_repo>} {(DQ ($ Id.VSub_DollarName name))} {(DQ ($ Id.VSub_Number 4))} {(DQ ($ Id.VSub_Number 5))} {(DQ ($ Id.VSub_Number 6))} ) (C {<shift>} {<6>}) (C {<try_case>} {(DQ ($ Id.VSub_DollarName name))} {(DQ ($ Id.VSub_DollarName worktreeenv))} {(DQ ($ Id.VSub_DollarName gitdirenv))} {(DQ ($ Id.VSub_Number 1))} {(DQ ($ Id.VSub_Number 2))} {(DQ ($ Id.VSub_Number 3))} {(DQ ($ Id.VSub_Number 4))} ) (C {<shift>} {<4>}) (command.Case to_match: {(DQ ($ Id.VSub_DollarName gitdirenv))} arms: [ (case_arm pat_list: [ {<'/'> <Id.Lit_Star '*'>} {<Id.Lit_QMark '?'> <Id.Lit_Colon ':'> <'/'> <Id.Lit_Star '*'>} {<unset>} ] action: [] spids: [922 935 937 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'gitdirenv='> name: gitdirenv ) op: assign_op.Equal rhs: {<'../'> ($ Id.VSub_DollarName gitdirenv)} spids: [944] ) ] redirects: [] ) ] spids: [940 941 948 -1] ) ] redirects: [] ) (C {<try_case>} {(DQ ($ Id.VSub_DollarName name) <'/sub'>)} {(DQ ($ Id.VSub_DollarName worktreeenv))} {(DQ ($ Id.VSub_DollarName gitdirenv))} {(DQ ($ Id.VSub_Number 1))} {(DQ ($ Id.VSub_Number 2))} {(DQ ($ Id.VSub_Number 3))} {(DQ ($ Id.VSub_Number 4))} ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'#0: nonbare repo, no explicit configuration'>)} { (SQ <'\n'> <'\ttry_repo 0 unset unset unset "" unset \\\n'> <'\t\t.git "$here/0" "$here/0" "(null)" \\\n'> <'\t\t.git "$here/0" "$here/0" sub/ 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#1: GIT_WORK_TREE without explicit GIT_DIR is accepted'>)} { (SQ <'\n'> <'\tmkdir -p wt &&\n'> <'\ttry_repo 1 "$here" unset unset "" unset \\\n'> <'\t\t"$here/1/.git" "$here" "$here" 1/ \\\n'> <'\t\t"$here/1/.git" "$here" "$here" 1/sub/ 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#2: worktree defaults to cwd with explicit GIT_DIR'>)} { (SQ <'\n'> <'\ttry_repo 2 unset "$here/2/.git" unset "" unset \\\n'> <'\t\t"$here/2/.git" "$here/2" "$here/2" "(null)" \\\n'> <'\t\t"$here/2/.git" "$here/2/sub" "$here/2/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#2b: relative GIT_DIR'>)} { (SQ <'\n'> <'\ttry_repo 2b unset ".git" unset "" unset \\\n'> <'\t\t".git" "$here/2b" "$here/2b" "(null)" \\\n'> <'\t\t"../.git" "$here/2b/sub" "$here/2b/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#3: setup'>)} {(SQ <'\n'> <'\tsetup_repo 3 unset "" unset &&\n'> <'\tmkdir -p 3/sub/sub 3/wt/sub\n'>)} ) (C {<run_wt_tests>} {<3>}) (C {<test_expect_success>} {(SQ <'#4: core.worktree without GIT_DIR set is accepted'>)} { (SQ <'\n'> <'\tsetup_repo 4 ../sub "" unset &&\n'> <'\tmkdir -p 4/sub sub &&\n'> <'\ttry_case 4 unset unset \\\n'> <'\t\t.git "$here/4/sub" "$here/4" "(null)" \\\n'> <'\t\t"$here/4/.git" "$here/4/sub" "$here/4/sub" "(null)" 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#5: core.worktree + GIT_WORK_TREE is accepted'>)} { (SQ <'\n'> <'\t# or: you cannot intimidate away the lack of GIT_DIR setting\n'> <'\ttry_repo 5 "$here" unset "$here/5" "" unset \\\n'> <'\t\t"$here/5/.git" "$here" "$here" 5/ \\\n'> <'\t\t"$here/5/.git" "$here" "$here" 5/sub/ 2>message &&\n'> <'\ttry_repo 5a .. unset "$here/5a" "" unset \\\n'> <'\t\t"$here/5a/.git" "$here" "$here" 5a/ \\\n'> <'\t\t"$here/5a/.git" "$here/5a" "$here/5a" sub/ &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#6: setting GIT_DIR brings core.worktree to life'>)} { (SQ <'\n'> <'\tsetup_repo 6 "$here/6" "" unset &&\n'> <'\ttry_case 6 unset .git \\\n'> <'\t\t.git "$here/6" "$here/6" "(null)" &&\n'> <'\ttry_case 6 unset "$here/6/.git" \\\n'> <'\t\t"$here/6/.git" "$here/6" "$here/6" "(null)" &&\n'> <'\ttry_case 6/sub/sub unset ../../.git \\\n'> <'\t\t"$here/6/.git" "$here/6" "$here/6" sub/sub/ &&\n'> <'\ttry_case 6/sub/sub unset "$here/6/.git" \\\n'> <'\t\t"$here/6/.git" "$here/6" "$here/6" sub/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#6b: GIT_DIR set, core.worktree relative'>)} { (SQ <'\n'> <'\tsetup_repo 6b .. "" unset &&\n'> <'\ttry_case 6b unset .git \\\n'> <'\t\t.git "$here/6b" "$here/6b" "(null)" &&\n'> <'\ttry_case 6b unset "$here/6b/.git" \\\n'> <'\t\t"$here/6b/.git" "$here/6b" "$here/6b" "(null)" &&\n'> <'\ttry_case 6b/sub/sub unset ../../.git \\\n'> <'\t\t"$here/6b/.git" "$here/6b" "$here/6b" sub/sub/ &&\n'> <'\ttry_case 6b/sub/sub unset "$here/6b/.git" \\\n'> <'\t\t"$here/6b/.git" "$here/6b" "$here/6b" sub/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#6c: GIT_DIR set, core.worktree=../wt (absolute)'>)} { (SQ <'\n'> <'\tsetup_repo 6c "$here/6c/wt" "" unset &&\n'> <'\tmkdir -p 6c/wt/sub &&\n'> <'\n'> <'\ttry_case 6c unset .git \\\n'> <'\t\t.git "$here/6c/wt" "$here/6c" "(null)" &&\n'> <'\ttry_case 6c unset "$here/6c/.git" \\\n'> <'\t\t"$here/6c/.git" "$here/6c/wt" "$here/6c" "(null)" &&\n'> <'\ttry_case 6c/sub/sub unset ../../.git \\\n'> <'\t\t../../.git "$here/6c/wt" "$here/6c/sub/sub" "(null)" &&\n'> <'\ttry_case 6c/sub/sub unset "$here/6c/.git" \\\n'> <'\t\t"$here/6c/.git" "$here/6c/wt" "$here/6c/sub/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#6d: GIT_DIR set, core.worktree=../wt (relative)'>)} { (SQ <'\n'> <'\tsetup_repo 6d "$here/6d/wt" "" unset &&\n'> <'\tmkdir -p 6d/wt/sub &&\n'> <'\n'> <'\ttry_case 6d unset .git \\\n'> <'\t\t.git "$here/6d/wt" "$here/6d" "(null)" &&\n'> <'\ttry_case 6d unset "$here/6d/.git" \\\n'> <'\t\t"$here/6d/.git" "$here/6d/wt" "$here/6d" "(null)" &&\n'> <'\ttry_case 6d/sub/sub unset ../../.git \\\n'> <'\t\t../../.git "$here/6d/wt" "$here/6d/sub/sub" "(null)" &&\n'> <'\ttry_case 6d/sub/sub unset "$here/6d/.git" \\\n'> <'\t\t"$here/6d/.git" "$here/6d/wt" "$here/6d/sub/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#6e: GIT_DIR set, core.worktree=../.. (absolute)'>)} { (SQ <'\n'> <'\tsetup_repo 6e "$here" "" unset &&\n'> <'\ttry_case 6e unset .git \\\n'> <'\t\t"$here/6e/.git" "$here" "$here" 6e/ &&\n'> <'\ttry_case 6e unset "$here/6e/.git" \\\n'> <'\t\t"$here/6e/.git" "$here" "$here" 6e/ &&\n'> <'\ttry_case 6e/sub/sub unset ../../.git \\\n'> <'\t\t"$here/6e/.git" "$here" "$here" 6e/sub/sub/ &&\n'> <'\ttry_case 6e/sub/sub unset "$here/6e/.git" \\\n'> <'\t\t"$here/6e/.git" "$here" "$here" 6e/sub/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#6f: GIT_DIR set, core.worktree=../.. (relative)'>)} { (SQ <'\n'> <'\tsetup_repo 6f ../../ "" unset &&\n'> <'\ttry_case 6f unset .git \\\n'> <'\t\t"$here/6f/.git" "$here" "$here" 6f/ &&\n'> <'\ttry_case 6f unset "$here/6f/.git" \\\n'> <'\t\t"$here/6f/.git" "$here" "$here" 6f/ &&\n'> <'\ttry_case 6f/sub/sub unset ../../.git \\\n'> <'\t\t"$here/6f/.git" "$here" "$here" 6f/sub/sub/ &&\n'> <'\ttry_case 6f/sub/sub unset "$here/6f/.git" \\\n'> <'\t\t"$here/6f/.git" "$here" "$here" 6f/sub/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#7: setup'>)} {(SQ <'\n'> <'\tsetup_repo 7 non-existent "" unset &&\n'> <'\tmkdir -p 7/sub/sub 7/wt/sub\n'>)} ) (C {<run_wt_tests>} {<7>}) (C {<test_expect_success>} {(SQ <'#8: gitfile, easy case'>)} { (SQ <'\n'> <'\ttry_repo 8 unset unset unset gitfile unset \\\n'> <'\t\t"$here/8.git" "$here/8" "$here/8" "(null)" \\\n'> <'\t\t"$here/8.git" "$here/8" "$here/8" sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#9: GIT_WORK_TREE accepted with gitfile'>)} { (SQ <'\n'> <'\tmkdir -p 9/wt &&\n'> <'\ttry_repo 9 wt unset unset gitfile unset \\\n'> <'\t\t"$here/9.git" "$here/9/wt" "$here/9" "(null)" \\\n'> <'\t\t"$here/9.git" "$here/9/sub/wt" "$here/9/sub" "(null)" 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#10: GIT_DIR can point to gitfile'>)} { (SQ <'\n'> <'\ttry_repo 10 unset "$here/10/.git" unset gitfile unset \\\n'> <'\t\t"$here/10.git" "$here/10" "$here/10" "(null)" \\\n'> <'\t\t"$here/10.git" "$here/10/sub" "$here/10/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#10b: relative GIT_DIR can point to gitfile'>)} { (SQ <'\n'> <'\ttry_repo 10b unset .git unset gitfile unset \\\n'> <'\t\t"$here/10b.git" "$here/10b" "$here/10b" "(null)" \\\n'> <'\t\t"$here/10b.git" "$here/10b/sub" "$here/10b/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#11: setup'>)} {(SQ <'\n'> <'\tsetup_repo 11 unset gitfile unset &&\n'> <'\tmkdir -p 11/sub/sub 11/wt/sub\n'>)} ) (C {<run_wt_tests>} {<11>} {<gitfile>}) (C {<test_expect_success>} {(SQ <'#12: core.worktree with gitfile is accepted'>)} { (SQ <'\n'> <'\ttry_repo 12 unset unset "$here/12" gitfile unset \\\n'> <'\t\t"$here/12.git" "$here/12" "$here/12" "(null)" \\\n'> <'\t\t"$here/12.git" "$here/12" "$here/12" sub/ 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#13: core.worktree+GIT_WORK_TREE accepted (with gitfile)'>)} { (SQ <'\n'> <'\t# or: you cannot intimidate away the lack of GIT_DIR setting\n'> <'\ttry_repo 13 non-existent-too unset non-existent gitfile unset \\\n'> <'\t\t"$here/13.git" "$here/13/non-existent-too" "$here/13" "(null)" \\\n'> < '\t\t"$here/13.git" "$here/13/sub/non-existent-too" "$here/13/sub" "(null)" 2>message &&\n' > <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#14: core.worktree with GIT_DIR pointing to gitfile'>)} { (SQ <'\n'> <'\tsetup_repo 14 "$here/14" gitfile unset &&\n'> <'\ttry_case 14 unset .git \\\n'> <'\t\t"$here/14.git" "$here/14" "$here/14" "(null)" &&\n'> <'\ttry_case 14 unset "$here/14/.git" \\\n'> <'\t\t"$here/14.git" "$here/14" "$here/14" "(null)" &&\n'> <'\ttry_case 14/sub/sub unset ../../.git \\\n'> <'\t\t"$here/14.git" "$here/14" "$here/14" sub/sub/ &&\n'> <'\ttry_case 14/sub/sub unset "$here/14/.git" \\\n'> <'\t\t"$here/14.git" "$here/14" "$here/14" sub/sub/ &&\n'> <'\n'> <'\tsetup_repo 14c "$here/14c/wt" gitfile unset &&\n'> <'\tmkdir -p 14c/wt/sub &&\n'> <'\n'> <'\ttry_case 14c unset .git \\\n'> <'\t\t"$here/14c.git" "$here/14c/wt" "$here/14c" "(null)" &&\n'> <'\ttry_case 14c unset "$here/14c/.git" \\\n'> <'\t\t"$here/14c.git" "$here/14c/wt" "$here/14c" "(null)" &&\n'> <'\ttry_case 14c/sub/sub unset ../../.git \\\n'> <'\t\t"$here/14c.git" "$here/14c/wt" "$here/14c/sub/sub" "(null)" &&\n'> <'\ttry_case 14c/sub/sub unset "$here/14c/.git" \\\n'> <'\t\t"$here/14c.git" "$here/14c/wt" "$here/14c/sub/sub" "(null)" &&\n'> <'\n'> <'\tsetup_repo 14d "$here/14d/wt" gitfile unset &&\n'> <'\tmkdir -p 14d/wt/sub &&\n'> <'\n'> <'\ttry_case 14d unset .git \\\n'> <'\t\t"$here/14d.git" "$here/14d/wt" "$here/14d" "(null)" &&\n'> <'\ttry_case 14d unset "$here/14d/.git" \\\n'> <'\t\t"$here/14d.git" "$here/14d/wt" "$here/14d" "(null)" &&\n'> <'\ttry_case 14d/sub/sub unset ../../.git \\\n'> <'\t\t"$here/14d.git" "$here/14d/wt" "$here/14d/sub/sub" "(null)" &&\n'> <'\ttry_case 14d/sub/sub unset "$here/14d/.git" \\\n'> <'\t\t"$here/14d.git" "$here/14d/wt" "$here/14d/sub/sub" "(null)" &&\n'> <'\n'> <'\tsetup_repo 14e "$here" gitfile unset &&\n'> <'\ttry_case 14e unset .git \\\n'> <'\t\t"$here/14e.git" "$here" "$here" 14e/ &&\n'> <'\ttry_case 14e unset "$here/14e/.git" \\\n'> <'\t\t"$here/14e.git" "$here" "$here" 14e/ &&\n'> <'\ttry_case 14e/sub/sub unset ../../.git \\\n'> <'\t\t"$here/14e.git" "$here" "$here" 14e/sub/sub/ &&\n'> <'\ttry_case 14e/sub/sub unset "$here/14e/.git" \\\n'> <'\t\t"$here/14e.git" "$here" "$here" 14e/sub/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#14b: core.worktree is relative to actual git dir'>)} { (SQ <'\n'> <'\tsetup_repo 14b ../14b gitfile unset &&\n'> <'\ttry_case 14b unset .git \\\n'> <'\t\t"$here/14b.git" "$here/14b" "$here/14b" "(null)" &&\n'> <'\ttry_case 14b unset "$here/14b/.git" \\\n'> <'\t\t"$here/14b.git" "$here/14b" "$here/14b" "(null)" &&\n'> <'\ttry_case 14b/sub/sub unset ../../.git \\\n'> <'\t\t"$here/14b.git" "$here/14b" "$here/14b" sub/sub/ &&\n'> <'\ttry_case 14b/sub/sub unset "$here/14b/.git" \\\n'> <'\t\t"$here/14b.git" "$here/14b" "$here/14b" sub/sub/ &&\n'> <'\n'> <'\tsetup_repo 14f ../ gitfile unset &&\n'> <'\ttry_case 14f unset .git \\\n'> <'\t\t"$here/14f.git" "$here" "$here" 14f/ &&\n'> <'\ttry_case 14f unset "$here/14f/.git" \\\n'> <'\t\t"$here/14f.git" "$here" "$here" 14f/ &&\n'> <'\ttry_case 14f/sub/sub unset ../../.git \\\n'> <'\t\t"$here/14f.git" "$here" "$here" 14f/sub/sub/ &&\n'> <'\ttry_case 14f/sub/sub unset "$here/14f/.git" \\\n'> <'\t\t"$here/14f.git" "$here" "$here" 14f/sub/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#15: setup'>)} { (SQ <'\n'> <'\tsetup_repo 15 non-existent gitfile unset &&\n'> <'\tmkdir -p 15/sub/sub 15/wt/sub\n'> ) } ) (C {<run_wt_tests>} {<15>} {<gitfile>}) (C {<test_expect_success>} {(SQ <'#16a: implicitly bare repo (cwd inside .git dir)'>)} { (SQ <'\n'> <'\tsetup_repo 16a unset "" unset &&\n'> <'\tmkdir -p 16a/.git/wt/sub &&\n'> <'\n'> <'\ttry_case 16a/.git unset unset \\\n'> <'\t\t. "(null)" "$here/16a/.git" "(null)" &&\n'> <'\ttry_case 16a/.git/wt unset unset \\\n'> <'\t\t"$here/16a/.git" "(null)" "$here/16a/.git/wt" "(null)" &&\n'> <'\ttry_case 16a/.git/wt/sub unset unset \\\n'> <'\t\t"$here/16a/.git" "(null)" "$here/16a/.git/wt/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#16b: bare .git (cwd inside .git dir)'>)} { (SQ <'\n'> <'\tsetup_repo 16b unset "" true &&\n'> <'\tmkdir -p 16b/.git/wt/sub &&\n'> <'\n'> <'\ttry_case 16b/.git unset unset \\\n'> <'\t\t. "(null)" "$here/16b/.git" "(null)" &&\n'> <'\ttry_case 16b/.git/wt unset unset \\\n'> <'\t\t"$here/16b/.git" "(null)" "$here/16b/.git/wt" "(null)" &&\n'> <'\ttry_case 16b/.git/wt/sub unset unset \\\n'> <'\t\t"$here/16b/.git" "(null)" "$here/16b/.git/wt/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#16c: bare .git has no worktree'>)} { (SQ <'\n'> <'\ttry_repo 16c unset unset unset "" true \\\n'> <'\t\t.git "(null)" "$here/16c" "(null)" \\\n'> <'\t\t"$here/16c/.git" "(null)" "$here/16c/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#16d: bareness preserved across alias'>)} { (SQ <'\n'> <'\tsetup_repo 16d unset "" unset &&\n'> <'\t(\n'> <'\t\tcd 16d/.git &&\n'> <'\t\ttest_must_fail git status &&\n'> <'\t\tgit config alias.st status &&\n'> <'\t\ttest_must_fail git st\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'#16e: bareness preserved by --bare'>)} { (SQ <'\n'> <'\tsetup_repo 16e unset "" unset &&\n'> <'\t(\n'> <'\t\tcd 16e/.git &&\n'> <'\t\ttest_must_fail git status &&\n'> <'\t\ttest_must_fail git --bare status\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'#17: GIT_WORK_TREE without explicit GIT_DIR is accepted (bare case)'>)} { (SQ <'\n'> <'\t# Just like #16.\n'> <'\tsetup_repo 17a unset "" true &&\n'> <'\tsetup_repo 17b unset "" true &&\n'> <'\tmkdir -p 17a/.git/wt/sub &&\n'> <'\tmkdir -p 17b/.git/wt/sub &&\n'> <'\n'> <'\ttry_case 17a/.git "$here/17a" unset \\\n'> <'\t\t"$here/17a/.git" "$here/17a" "$here/17a" .git/ \\\n'> <'\t\t2>message &&\n'> <'\ttry_case 17a/.git/wt "$here/17a" unset \\\n'> <'\t\t"$here/17a/.git" "$here/17a" "$here/17a" .git/wt/ &&\n'> <'\ttry_case 17a/.git/wt/sub "$here/17a" unset \\\n'> <'\t\t"$here/17a/.git" "$here/17a" "$here/17a" .git/wt/sub/ &&\n'> <'\n'> <'\ttry_case 17b/.git "$here/17b" unset \\\n'> <'\t\t"$here/17b/.git" "$here/17b" "$here/17b" .git/ &&\n'> <'\ttry_case 17b/.git/wt "$here/17b" unset \\\n'> <'\t\t"$here/17b/.git" "$here/17b" "$here/17b" .git/wt/ &&\n'> <'\ttry_case 17b/.git/wt/sub "$here/17b" unset \\\n'> <'\t\t"$here/17b/.git" "$here/17b" "$here/17b" .git/wt/sub/ &&\n'> <'\n'> <'\ttry_repo 17c "$here/17c" unset unset "" true \\\n'> <'\t\t.git "$here/17c" "$here/17c" "(null)" \\\n'> <'\t\t"$here/17c/.git" "$here/17c" "$here/17c" sub/ 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#18: bare .git named by GIT_DIR has no worktree'>)} { (SQ <'\n'> <'\ttry_repo 18 unset .git unset "" true \\\n'> <'\t\t.git "(null)" "$here/18" "(null)" \\\n'> <'\t\t../.git "(null)" "$here/18/sub" "(null)" &&\n'> <'\ttry_repo 18b unset "$here/18b/.git" unset "" true \\\n'> <'\t\t"$here/18b/.git" "(null)" "$here/18b" "(null)" \\\n'> <'\t\t"$here/18b/.git" "(null)" "$here/18b/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#19: setup'>)} {(SQ <'\n'> <'\tsetup_repo 19 unset "" true &&\n'> <'\tmkdir -p 19/sub/sub 19/wt/sub\n'>)} ) (C {<run_wt_tests>} {<19>}) (C {<test_expect_success>} {(SQ <'#20a: core.worktree without GIT_DIR accepted (inside .git)'>)} { (SQ <'\n'> <'\t# Unlike case #16a.\n'> <'\tsetup_repo 20a "$here/20a" "" unset &&\n'> <'\tmkdir -p 20a/.git/wt/sub &&\n'> <'\ttry_case 20a/.git unset unset \\\n'> <'\t\t"$here/20a/.git" "$here/20a" "$here/20a" .git/ 2>message &&\n'> <'\ttry_case 20a/.git/wt unset unset \\\n'> <'\t\t"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/ &&\n'> <'\ttry_case 20a/.git/wt/sub unset unset \\\n'> <'\t\t"$here/20a/.git" "$here/20a" "$here/20a" .git/wt/sub/ &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#20b/c: core.worktree and core.bare conflict'>)} { (SQ <'\n'> <'\tsetup_repo 20b non-existent "" true &&\n'> <'\tmkdir -p 20b/.git/wt/sub &&\n'> <'\t(\n'> <'\t\tcd 20b/.git &&\n'> <'\t\ttest_must_fail git status >/dev/null\n'> <'\t) 2>message &&\n'> <'\tgrep "core.bare and core.worktree" message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#20d: core.worktree and core.bare OK when working tree not needed'>)} { (SQ <'\n'> <'\tsetup_repo 20d non-existent "" true &&\n'> <'\tmkdir -p 20d/.git/wt/sub &&\n'> <'\t(\n'> <'\t\tcd 20d/.git &&\n'> <'\t\tgit config foo.bar value\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'#21: setup, core.worktree warns before overriding core.bare'>)} { (SQ <'\n'> <'\tsetup_repo 21 non-existent "" unset &&\n'> <'\tmkdir -p 21/.git/wt/sub &&\n'> <'\t(\n'> <'\t\tcd 21/.git &&\n'> <'\t\tGIT_WORK_TREE="$here/21" &&\n'> <'\t\texport GIT_WORK_TREE &&\n'> <'\t\tgit status >/dev/null\n'> <'\t) 2>message &&\n'> <'\t! test -s message\n'> <'\n'> ) } ) (C {<run_wt_tests>} {<21>}) (C {<test_expect_success>} {(SQ <'#22a: core.worktree = GIT_DIR = .git dir'>)} { (SQ <'\n'> <'\t# like case #6.\n'> <'\n'> <'\tsetup_repo 22a "$here/22a/.git" "" unset &&\n'> <'\tsetup_repo 22ab . "" unset &&\n'> <'\tmkdir -p 22a/.git/sub 22a/sub &&\n'> <'\tmkdir -p 22ab/.git/sub 22ab/sub &&\n'> <'\ttry_case 22a/.git unset . \\\n'> <'\t\t. "$here/22a/.git" "$here/22a/.git" "(null)" &&\n'> <'\ttry_case 22a/.git unset "$here/22a/.git" \\\n'> <'\t\t"$here/22a/.git" "$here/22a/.git" "$here/22a/.git" "(null)" &&\n'> <'\ttry_case 22a/.git/sub unset .. \\\n'> <'\t\t"$here/22a/.git" "$here/22a/.git" "$here/22a/.git" sub/ &&\n'> <'\ttry_case 22a/.git/sub unset "$here/22a/.git" \\\n'> <'\t\t"$here/22a/.git" "$here/22a/.git" "$here/22a/.git" sub/ &&\n'> <'\n'> <'\ttry_case 22ab/.git unset . \\\n'> <'\t\t. "$here/22ab/.git" "$here/22ab/.git" "(null)" &&\n'> <'\ttry_case 22ab/.git unset "$here/22ab/.git" \\\n'> <'\t\t"$here/22ab/.git" "$here/22ab/.git" "$here/22ab/.git" "(null)" &&\n'> <'\ttry_case 22ab/.git/sub unset .. \\\n'> <'\t\t"$here/22ab/.git" "$here/22ab/.git" "$here/22ab/.git" sub/ &&\n'> <'\ttry_case 22ab/.git unset "$here/22ab/.git" \\\n'> <'\t\t"$here/22ab/.git" "$here/22ab/.git" "$here/22ab/.git" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#22b: core.worktree child of .git, GIT_DIR=.git'>)} { (SQ <'\n'> <'\tsetup_repo 22b "$here/22b/.git/wt" "" unset &&\n'> <'\tsetup_repo 22bb wt "" unset &&\n'> <'\tmkdir -p 22b/.git/sub 22b/sub 22b/.git/wt/sub 22b/wt/sub &&\n'> <'\tmkdir -p 22bb/.git/sub 22bb/sub 22bb/.git/wt 22bb/wt &&\n'> <'\n'> <'\ttry_case 22b/.git unset . \\\n'> <'\t\t. "$here/22b/.git/wt" "$here/22b/.git" "(null)" &&\n'> <'\ttry_case 22b/.git unset "$here/22b/.git" \\\n'> <'\t\t"$here/22b/.git" "$here/22b/.git/wt" "$here/22b/.git" "(null)" &&\n'> <'\ttry_case 22b/.git/sub unset .. \\\n'> <'\t\t.. "$here/22b/.git/wt" "$here/22b/.git/sub" "(null)" &&\n'> <'\ttry_case 22b/.git/sub unset "$here/22b/.git" \\\n'> <'\t\t"$here/22b/.git" "$here/22b/.git/wt" "$here/22b/.git/sub" "(null)" &&\n'> <'\n'> <'\ttry_case 22bb/.git unset . \\\n'> <'\t\t. "$here/22bb/.git/wt" "$here/22bb/.git" "(null)" &&\n'> <'\ttry_case 22bb/.git unset "$here/22bb/.git" \\\n'> <'\t\t"$here/22bb/.git" "$here/22bb/.git/wt" "$here/22bb/.git" "(null)" &&\n'> <'\ttry_case 22bb/.git/sub unset .. \\\n'> <'\t\t.. "$here/22bb/.git/wt" "$here/22bb/.git/sub" "(null)" &&\n'> <'\ttry_case 22bb/.git/sub unset "$here/22bb/.git" \\\n'> <'\t\t"$here/22bb/.git" "$here/22bb/.git/wt" "$here/22bb/.git/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#22c: core.worktree = .git/.., GIT_DIR=.git'>)} { (SQ <'\n'> <'\tsetup_repo 22c "$here/22c" "" unset &&\n'> <'\tsetup_repo 22cb .. "" unset &&\n'> <'\tmkdir -p 22c/.git/sub 22c/sub &&\n'> <'\tmkdir -p 22cb/.git/sub 22cb/sub &&\n'> <'\n'> <'\ttry_case 22c/.git unset . \\\n'> <'\t\t"$here/22c/.git" "$here/22c" "$here/22c" .git/ &&\n'> <'\ttry_case 22c/.git unset "$here/22c/.git" \\\n'> <'\t\t"$here/22c/.git" "$here/22c" "$here/22c" .git/ &&\n'> <'\ttry_case 22c/.git/sub unset .. \\\n'> <'\t\t"$here/22c/.git" "$here/22c" "$here/22c" .git/sub/ &&\n'> <'\ttry_case 22c/.git/sub unset "$here/22c/.git" \\\n'> <'\t\t"$here/22c/.git" "$here/22c" "$here/22c" .git/sub/ &&\n'> <'\n'> <'\ttry_case 22cb/.git unset . \\\n'> <'\t\t"$here/22cb/.git" "$here/22cb" "$here/22cb" .git/ &&\n'> <'\ttry_case 22cb/.git unset "$here/22cb/.git" \\\n'> <'\t\t"$here/22cb/.git" "$here/22cb" "$here/22cb" .git/ &&\n'> <'\ttry_case 22cb/.git/sub unset .. \\\n'> <'\t\t"$here/22cb/.git" "$here/22cb" "$here/22cb" .git/sub/ &&\n'> <'\ttry_case 22cb/.git/sub unset "$here/22cb/.git" \\\n'> <'\t\t"$here/22cb/.git" "$here/22cb" "$here/22cb" .git/sub/\n'> ) } ) (C {<test_expect_success>} {(SQ <'#22.2: core.worktree and core.bare conflict'>)} { (SQ <'\n'> <'\tsetup_repo 22 "$here/22" "" true &&\n'> <'\t(\n'> <'\t\tcd 22/.git &&\n'> <'\t\tGIT_DIR=. &&\n'> <'\t\texport GIT_DIR &&\n'> <'\t\ttest_must_fail git status 2>result\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd 22 &&\n'> <'\t\tGIT_DIR=.git &&\n'> <'\t\texport GIT_DIR &&\n'> <'\t\ttest_must_fail git status 2>result\n'> <'\t) &&\n'> <'\tgrep "core.bare and core.worktree" 22/.git/result &&\n'> <'\tgrep "core.bare and core.worktree" 22/result\n'> ) } ) (C {<test_expect_success>} {(SQ <'#23: setup'>)} { (SQ <'\n'> <'\tsetup_repo 23 non-existent "" true &&\n'> <'\tmkdir -p 23/sub/sub 23/wt/sub\n'>) } ) (C {<run_wt_tests>} {<23>}) (C {<test_expect_success>} {(SQ <'#24: bare repo has no worktree (gitfile case)'>)} { (SQ <'\n'> <'\ttry_repo 24 unset unset unset gitfile true \\\n'> <'\t\t"$here/24.git" "(null)" "$here/24" "(null)" \\\n'> <'\t\t"$here/24.git" "(null)" "$here/24/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#25: GIT_WORK_TREE accepted if GIT_DIR unset (bare gitfile case)'>)} { (SQ <'\n'> <'\ttry_repo 25 "$here/25" unset unset gitfile true \\\n'> <'\t\t"$here/25.git" "$here/25" "$here/25" "(null)" \\\n'> <'\t\t"$here/25.git" "$here/25" "$here/25" "sub/" 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#26: bare repo has no worktree (GIT_DIR -> gitfile case)'>)} { (SQ <'\n'> <'\ttry_repo 26 unset "$here/26/.git" unset gitfile true \\\n'> <'\t\t"$here/26.git" "(null)" "$here/26" "(null)" \\\n'> <'\t\t"$here/26.git" "(null)" "$here/26/sub" "(null)" &&\n'> <'\ttry_repo 26b unset .git unset gitfile true \\\n'> <'\t\t"$here/26b.git" "(null)" "$here/26b" "(null)" \\\n'> <'\t\t"$here/26b.git" "(null)" "$here/26b/sub" "(null)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'#27: setup'>)} {(SQ <'\n'> <'\tsetup_repo 27 unset gitfile true &&\n'> <'\tmkdir -p 27/sub/sub 27/wt/sub\n'>)} ) (C {<run_wt_tests>} {<27>} {<gitfile>}) (C {<test_expect_success>} {(SQ <'#28: core.worktree and core.bare conflict (gitfile case)'>)} { (SQ <'\n'> <'\tsetup_repo 28 "$here/28" gitfile true &&\n'> <'\t(\n'> <'\t\tcd 28 &&\n'> <'\t\ttest_must_fail git status\n'> <'\t) 2>message &&\n'> <'\tgrep "core.bare and core.worktree" message\n'> ) } ) (C {<test_expect_success>} {(SQ <'#29: setup'>)} { (SQ <'\n'> <'\tsetup_repo 29 non-existent gitfile true &&\n'> <'\tmkdir -p 29/sub/sub 29/wt/sub &&\n'> <'\t(\n'> <'\t\tcd 29 &&\n'> <'\t\tGIT_WORK_TREE="$here/29" &&\n'> <'\t\texport GIT_WORK_TREE &&\n'> <'\t\tgit status\n'> <'\t) 2>message &&\n'> <'\t! test -s message\n'> ) } ) (C {<run_wt_tests>} {<29>} {<gitfile>}) (C {<test_expect_success>} {(SQ <'#30: core.worktree and core.bare conflict (gitfile version)'>)} { (SQ <'\n'> <'\t# Just like case #22.\n'> <'\tsetup_repo 30 "$here/30" gitfile true &&\n'> <'\t(\n'> <'\t\tcd 30 &&\n'> <'\t\ttest_must_fail env GIT_DIR=.git git status 2>result\n'> <'\t) &&\n'> <'\tgrep "core.bare and core.worktree" 30/result\n'> ) } ) (C {<test_expect_success>} {(SQ <'#31: setup'>)} { (SQ <'\n'> <'\tsetup_repo 31 non-existent gitfile true &&\n'> <'\tmkdir -p 31/sub/sub 31/wt/sub\n'> ) } ) (C {<run_wt_tests>} {<31>} {<gitfile>}) (C {<test_done>}) ] )