(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) 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 ") ($ VSub_Name "$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] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:here) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub "$("> spids: [54 56] ) } spids: [53] ) ] spids: [53] ) (FuncDef name: test_repo body: (BraceGroup children: [ (Subshell child: (AndOr children: [ (C {(cd)} {(DQ ($ VSub_Number "$1"))}) (AndOr children: [ (If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Number "$2"))})] action: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ ($ VSub_Number "$2"))} spids: [93] ) ] spids: [93] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) ] spids: [-1 90] ) ] spids: [-1 106] ) (AndOr children: [ (If arms: [ (if_arm cond: [(C {(test)} {(-n)} {(DQ ($ VSub_Number "$3"))})] action: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_WORK_TREE) op: Equal rhs: {(DQ ($ VSub_Number "$3"))} spids: [125] ) ] spids: [125] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) ] spids: [-1 122] ) ] spids: [-1 138] ) (AndOr children: [ (C {(rm)} {(-f)} {(trace)}) (AndOr children: [ (SimpleCommand words: [{(git)} {(symbolic-ref)} {(HEAD)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [166] ) ] more_env: [ (env_pair name: GIT_TRACE_SETUP val: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub "$("> spids: [154 156] ) (/trace) ) } spids: [152] ) ] ) (AndOr children: [ (SimpleCommand words: [{(grep)} {(SQ <"^setup: ">)} {(trace)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(result)} spids: [180] ) ] ) (C {(test_cmp)} {(expected)} {(result)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) spids: [67 193] ) ] spids: [64] ) spids: [59 63] ) (FuncDef name: maybe_config body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file) op: Equal rhs: {($ VSub_Number "$1")} spids: [206] ) (assign_pair lhs: (LhsName name:var) op: Equal rhs: {($ VSub_Number "$2")} spids: [209] ) (assign_pair lhs: (LhsName name:value) op: Equal rhs: {($ VSub_Number "$3")} spids: [212] ) ] spids: [206] ) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$value"))} {(KW_Bang "!") (Lit_Other "=")} {(unset)} ) ] action: [ (C {(git)} {(config)} {(--file) (Lit_Other "=") (DQ ($ VSub_Name "$file"))} {(DQ ($ VSub_Name "$var"))} {(DQ ($ VSub_Name "$value"))} ) ] spids: [-1 232] ) ] spids: [-1 254] ) ] op_id: Op_DAmp ) ] spids: [203] ) spids: [198 202] ) (FuncDef name: setup_repo body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {($ VSub_Number "$1")} spids: [267] ) (assign_pair lhs: (LhsName name:worktreecfg) op: Equal rhs: {($ VSub_Number "$2")} spids: [270] ) (assign_pair lhs: (LhsName name:gitfile) op: Equal rhs: {($ VSub_Number "$3")} spids: [273] ) (assign_pair lhs: (LhsName name:barecfg) op: Equal rhs: {($ VSub_Number "$4")} spids: [276] ) ] spids: [267] ) (AndOr children: [ (C {(sane_unset)} {(GIT_DIR)} {(GIT_WORK_TREE)}) (AndOr children: [ (C {(git)} {(init)} {(DQ ($ VSub_Name "$name"))}) (AndOr children: [ (C {(maybe_config)} {(DQ ($ VSub_Name "$name") (/.git/config))} {(core.worktree)} {(DQ ($ VSub_Name "$worktreecfg"))} ) (AndOr children: [ (C {(maybe_config)} {(DQ ($ VSub_Name "$name") (/.git/config))} {(core.bare)} {(DQ ($ VSub_Name "$barecfg"))} ) (AndOr children: [ (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$name") (/sub/sub))}) (If arms: [ (if_arm cond: [ (C {(test)} { (DQ (BracedVarSub token: <VSub_Name gitfile> suffix_op: (StringUnary op_id: VTest_ColonPlus arg_word: {(set)} ) spids: [353 357] ) ) } ) ] action: [ (AndOr children: [ (C {(mv)} {(DQ ($ VSub_Name "$name") (/.git))} {(DQ ($ VSub_Name "$name") (.git))} ) (SimpleCommand words: [ {(echo)} { (DQ ("gitdir: ../") ($ VSub_Name "$name") (.git)) } ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$name") (/.git))} spids: [387] ) ] ) ] op_id: Op_DAmp ) ] spids: [-1 361] ) ] spids: [-1 394] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [264] ) spids: [259 263] ) (FuncDef name: maybe_set body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:var) op: Equal rhs: {($ VSub_Number "$1")} spids: [407] ) (assign_pair lhs: (LhsName name:value) op: Equal rhs: {($ VSub_Number "$2")} spids: [410] ) ] spids: [407] ) (If arms: [ (if_arm cond: [ (C {(test)} {(DQ ($ VSub_Name "$value"))} {(KW_Bang "!") (Lit_Other "=")} {(unset)} ) ] action: [ (AndOr children: [ (C {(eval)} { (DQ ($ VSub_Name "$var") ("=") (EscapedLiteralPart token: <Lit_EscapedChar "\\$"> ) (value) ) } ) (C {(export)} {($ VSub_Name "$var")}) ] op_id: Op_DAmp ) ] spids: [-1 430] ) ] spids: [-1 450] ) ] op_id: Op_DAmp ) ] spids: [404] ) spids: [399 403] ) (FuncDef name: setup_env body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:worktreenv) op: Equal rhs: {($ VSub_Number "$1")} spids: [463] ) (assign_pair lhs: (LhsName name:gitdirenv) op: Equal rhs: {($ VSub_Number "$2")} spids: [466] ) ] spids: [463] ) (AndOr children: [ (C {(sane_unset)} {(GIT_DIR)} {(GIT_WORK_TREE)}) (AndOr children: [ (C {(maybe_set)} {(GIT_DIR)} {(DQ ($ VSub_Name "$gitdirenv"))}) (C {(maybe_set)} {(GIT_WORK_TREE)} {(DQ ($ VSub_Name "$worktreeenv"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [460] ) spids: [455 459] ) (FuncDef name: expect body: (BraceGroup children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Number "$1") (/expected))} spids: [513] ) (HereDoc op_id: Redir_DLessDash fd: -1 body: { (DQ ("setup: git_dir: ") ($ VSub_Number "$2") ("\n") ("setup: git_common_dir: ") ($ VSub_Number "$2") ("\n") ("setup: worktree: ") ($ VSub_Number "$3") ("\n") ("setup: cwd: ") ($ VSub_Number "$4") ("\n") ("setup: prefix: ") ($ VSub_Number "$5") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [519] ) ] ) ] spids: [508] ) spids: [503 507] ) (FuncDef name: try_case body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {($ VSub_Number "$1")} spids: [548] ) (assign_pair lhs: (LhsName name:worktreeenv) op: Equal rhs: {($ VSub_Number "$2")} spids: [551] ) (assign_pair lhs: (LhsName name:gitdirenv) op: Equal rhs: {($ VSub_Number "$3")} spids: [554] ) ] spids: [548] ) (AndOr children: [ (C {(setup_env)} {(DQ ($ VSub_Name "$worktreeenv"))} {(DQ ($ VSub_Name "$gitdirenv"))} ) (AndOr children: [ (C {(expect)} {(DQ ($ VSub_Name "$name"))} {(DQ ($ VSub_Number "$4"))} {(DQ ($ VSub_Number "$5"))} {(DQ ($ VSub_Number "$6"))} {(DQ ($ VSub_Number "$7"))} ) (C {(test_repo)} {(DQ ($ VSub_Name "$name"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [545] ) spids: [540 544] ) (FuncDef name: run_wt_tests body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:N) op: Equal rhs: {($ VSub_Number "$1")} spids: [615] ) (assign_pair lhs: (LhsName name:gitfile) op: Equal rhs: {($ VSub_Number "$2")} spids: [618] ) ] spids: [615] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:absgit) op: Equal rhs: {(DQ ($ VSub_Name "$here") (/) ($ VSub_Name "$N") (/.git))} spids: [623] ) ] spids: [623] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:dotgit) op:Equal rhs:{(.git)} spids:[632])] spids: [632] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dotdotgit) op: Equal rhs: {(../../.git)} spids: [636] ) ] spids: [636] ) (If arms: [ (if_arm cond: [(C {(test)} {(DQ ($ VSub_Name "$gitfile"))})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:absgit) op: Equal rhs: {(DQ ($ VSub_Name "$here") (/) ($ VSub_Name "$N") (.git))} spids: [653] ) ] spids: [653] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:dotgit) op: Equal rhs: {($ VSub_Name "$absgit")} spids: [662] ) (assign_pair lhs: (LhsName name:dotdotgit) op: Equal rhs: {($ VSub_Name "$absgit")} spids: [665] ) ] spids: [662] ) ] spids: [-1 650] ) ] spids: [-1 669] ) (C {(test_expect_success)} {(DQ ("#") ($ VSub_Name "$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 ("#") ($ VSub_Name "$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 ("#") ($ VSub_Name "$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 ("#") ($ VSub_Name "$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 ("#") ($ VSub_Name "$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 ("#") ($ VSub_Name "$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"> ) } ) ] spids: [612] ) spids: [607 611] ) (FuncDef name: try_repo body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {($ VSub_Number "$1")} spids: [829] ) (assign_pair lhs: (LhsName name:worktreeenv) op: Equal rhs: {($ VSub_Number "$2")} spids: [832] ) (assign_pair lhs: (LhsName name:gitdirenv) op: Equal rhs: {($ VSub_Number "$3")} spids: [835] ) ] spids: [829] ) (AndOr children: [ (C {(setup_repo)} {(DQ ($ VSub_Name "$name"))} {(DQ ($ VSub_Number "$4"))} {(DQ ($ VSub_Number "$5"))} {(DQ ($ VSub_Number "$6"))} ) (AndOr children: [ (C {(shift)} {(6)}) (AndOr children: [ (C {(try_case)} {(DQ ($ VSub_Name "$name"))} {(DQ ($ VSub_Name "$worktreeenv"))} {(DQ ($ VSub_Name "$gitdirenv"))} {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))} {(DQ ($ VSub_Number "$3"))} {(DQ ($ VSub_Number "$4"))} ) (AndOr children: [ (C {(shift)} {(4)}) (AndOr children: [ (Case to_match: {(DQ ($ VSub_Name "$gitdirenv"))} arms: [ (case_arm pat_list: [ {(/) (Lit_Other "*")} {(Lit_Other "?") (Lit_Other ":") (/) (Lit_Other "*")} {(unset)} ] spids: [920 933 935 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:gitdirenv) op: Equal rhs: {(../) ($ VSub_Name "$gitdirenv")} spids: [942] ) ] spids: [942] ) ] spids: [938 939 946 -1] ) ] spids: [911 917 949] ) (C {(try_case)} {(DQ ($ VSub_Name "$name") (/sub))} {(DQ ($ VSub_Name "$worktreeenv"))} {(DQ ($ VSub_Name "$gitdirenv"))} {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))} {(DQ ($ VSub_Number "$3"))} {(DQ ($ VSub_Number "$4"))} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [826] ) spids: [821 825] ) (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)}) ] )