(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <'Test Git when git repository is located at root\n'> <'\n'> <'This test requires write access in root. Do not bother if you do not\n'> <'have a throwaway chroot or VM.\n'> <'\n'> <'Script t1509/prepare-chroot.sh may help you setup chroot, then you\n'> <'can chroot in and execute this test from there.\n'> ) } spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: test_cmp_val body: (BraceGroup children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$1'))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$2'))}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result)})] ) (C {(test_cmp)} {(expected)} {(result)}) ] spids: [25] ) spids: [21 24] ) (FuncDef name: test_vars body: (BraceGroup children: [ (C {(test_expect_success)} {(DQ ($ VSub_Number '$1') (': gitdir'))} {(SQ <'\n'> <'\t\ttest_cmp_val "'>) (DQ ($ VSub_Number '$2')) (SQ <'" "$(git rev-parse --git-dir)"\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ($ VSub_Number '$1') (': worktree'))} {(SQ <'\n'> <'\t\ttest_cmp_val "'>) (DQ ($ VSub_Number '$3')) (SQ <'" "$(git rev-parse --show-toplevel)"\n'> <'\t'>) } ) (C {(test_expect_success)} {(DQ ($ VSub_Number '$1') (': prefix'))} {(SQ <'\n'> <'\t\ttest_cmp_val "'>) (DQ ($ VSub_Number '$4')) (SQ <'" "$(git rev-parse --show-prefix)"\n'> <'\t'>) } ) ] spids: [63] ) spids: [59 62] ) (FuncDef name: test_foobar_root body: (BraceGroup children: [ (C {(test_expect_success)} {(SQ <'add relative'>)} { (SQ <'\n'> <'\t\ttest -z "$(cd / && git ls-files)" &&\n'> <'\t\tgit add foo/foome &&\n'> <'\t\tgit add foo/bar/barme &&\n'> <'\t\tgit add me &&\n'> <'\t\t( cd / && git ls-files --stage ) > result &&\n'> <'\t\ttest_cmp /ls.expected result &&\n'> <'\t\trm "$(git rev-parse --git-dir)/index"\n'> <'\t'> ) } ) (C {(test_expect_success)} {(SQ <'add absolute'>)} { (SQ <'\n'> <'\t\ttest -z "$(cd / && git ls-files)" &&\n'> <'\t\tgit add /foo/foome &&\n'> <'\t\tgit add /foo/bar/barme &&\n'> <'\t\tgit add /me &&\n'> <'\t\t( cd / && git ls-files --stage ) > result &&\n'> <'\t\ttest_cmp /ls.expected result &&\n'> <'\t\trm "$(git rev-parse --git-dir)/index"\n'> <'\t'> ) } ) ] spids: [134] ) spids: [130 133] ) (FuncDef name: test_foobar_foo body: (BraceGroup children: [ (C {(test_expect_success)} {(SQ <'add relative'>)} { (SQ <'\n'> <'\t\ttest -z "$(cd / && git ls-files)" &&\n'> <'\t\tgit add foome &&\n'> <'\t\tgit add bar/barme &&\n'> <'\t\tgit add ../me &&\n'> <'\t\t( cd / && git ls-files --stage ) > result &&\n'> <'\t\ttest_cmp /ls.expected result &&\n'> <'\t\trm "$(git rev-parse --git-dir)/index"\n'> <'\t'> ) } ) (C {(test_expect_success)} {(SQ <'add absolute'>)} { (SQ <'\n'> <'\t\ttest -z "$(cd / && git ls-files)" &&\n'> <'\t\tgit add /foo/foome &&\n'> <'\t\tgit add /foo/bar/barme &&\n'> <'\t\tgit add /me &&\n'> <'\t\t( cd / && git ls-files --stage ) > result &&\n'> <'\t\ttest_cmp /ls.expected result &&\n'> <'\t\trm "$(git rev-parse --git-dir)/index"\n'> <'\t'> ) } ) ] spids: [183] ) spids: [179 182] ) (FuncDef name: test_foobar_foobar body: (BraceGroup children: [ (C {(test_expect_success)} {(SQ <'add relative'>)} { (SQ <'\n'> <'\t\ttest -z "$(cd / && git ls-files)" &&\n'> <'\t\tgit add ../foome &&\n'> <'\t\tgit add barme &&\n'> <'\t\tgit add ../../me &&\n'> <'\t\t( cd / && git ls-files --stage ) > result &&\n'> <'\t\ttest_cmp /ls.expected result &&\n'> <'\t\trm "$(git rev-parse --git-dir)/index"\n'> <'\t'> ) } ) (C {(test_expect_success)} {(SQ <'add absolute'>)} { (SQ <'\n'> <'\t\ttest -z "$(cd / && git ls-files)" &&\n'> <'\t\tgit add /foo/foome &&\n'> <'\t\tgit add /foo/bar/barme &&\n'> <'\t\tgit add /me &&\n'> <'\t\t( cd / && git ls-files --stage ) > result &&\n'> <'\t\ttest_cmp /ls.expected result &&\n'> <'\t\trm "$(git rev-parse --git-dir)/index"\n'> <'\t'> ) } ) ] spids: [231] ) spids: [227 230] ) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test)} {(-w)} {(/)})] negated:T)] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: { (DQ ('Test requiring writable / skipped. Read this test if you want to run it')) } spids: [288] ) ] spids: [288] ) (C {(test_done)}) ] spids: [16777215 285] ) ] spids: [16777215 296] ) (If arms: [ (if_arm cond: [ (AndOr ops: [Op_DPipe Op_DPipe Op_DPipe Op_DPipe Op_DPipe Op_DPipe] children: [ (C {(test)} {(-e)} {(/refs)}) (C {(test)} {(-e)} {(/objects)}) (C {(test)} {(-e)} {(/info)}) (C {(test)} {(-e)} {(/hooks)}) (C {(test)} {(-e)} {(/.git)}) (C {(test)} {(-e)} {(/foo)}) (C {(test)} {(-e)} {(/me)}) ] ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(DQ ('Skip test that clobbers existing files in /'))} spids: [359] ) ] spids: [359] ) (C {(test_done)}) ] spids: [16777215 356] ) ] spids: [16777215 367] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$IKNOWWHATIAMDOING'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (YES))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(DQ ('You must set env var IKNOWWHATIAMDOING=YES in order to run this test'))} spids: [391] ) ] spids: [391] ) (C {(test_done)}) ] spids: [16777215 388] ) ] spids: [16777215 399] ) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test_have_prereq)} {(NOT_ROOT)})] negated:T)] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:skip_all) op: Equal rhs: {(DQ ("No you can't run this as root"))} spids: [413] ) ] spids: [413] ) (C {(test_done)}) ] spids: [16777215 410] ) ] spids: [16777215 421] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ONE_SHA1) op: Equal rhs: {(d00491fd7e5bb6fa28c517a0bb32b8b506539d4d)} spids: [424] ) ] spids: [424] ) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <'\n'> <'\trm -rf /foo &&\n'> <'\tmkdir /foo &&\n'> <'\tmkdir /foo/bar &&\n'> <'\techo 1 > /foo/foome &&\n'> <'\techo 1 > /foo/bar/barme &&\n'> <'\techo 1 > /me\n'> ) } ) (C {(say)} {(DQ ('GIT_DIR absolute, GIT_WORK_TREE set'))}) (C {(test_expect_success)} {(SQ <'go to /'>)} {(SQ <'cd /'>)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(ls.expected)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 481 stdin_parts: [ ('100644 ') ($ VSub_Name '$ONE_SHA1') (' 0\tfoo/bar/barme\n') ('100644 ') ($ VSub_Name '$ONE_SHA1') (' 0\tfoo/foome\n') ('100644 ') ($ VSub_Name '$ONE_SHA1') (' 0\tme\n') ] ) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [483] ) ] spids: [483] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[495])] spids: [495] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'abs gitdir, root'>)} {(DQ ($ VSub_Name '$GIT_DIR'))} {(DQ (/))} {(DQ )}) (C {(test_foobar_root)}) (C {(test_expect_success)} {(SQ <'go to /foo'>)} {(SQ <'cd /foo'>)}) (C {(test_vars)} {(SQ <'abs gitdir, foo'>)} {(DQ ($ VSub_Name '$GIT_DIR'))} {(DQ (/))} {(DQ (foo/))}) (C {(test_foobar_foo)}) (C {(test_expect_success)} {(SQ <'go to /foo/bar'>)} {(SQ <'cd /foo/bar'>)}) (C {(test_vars)} {(SQ <'abs gitdir, foo/bar'>)} {(DQ ($ VSub_Name '$GIT_DIR'))} {(DQ (/))} {(DQ (foo/bar/))} ) (C {(test_foobar_foobar)}) (C {(say)} {(DQ ('GIT_DIR relative, GIT_WORK_TREE set'))}) (C {(test_expect_success)} {(SQ <'go to /'>)} {(SQ <'cd /'>)}) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$TRASH_DIRECTORY')}) (C {(sed)} {(SQ <'s,^/,,'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [609 619] ) (/.git) ) } spids: [607] ) ] spids: [607] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[629])] spids: [629] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'rel gitdir, root'>)} {(DQ ($ VSub_Name '$GIT_DIR'))} {(DQ (/))} {(DQ )}) (C {(test_foobar_root)}) (C {(test_expect_success)} {(SQ <'go to /foo'>)} {(SQ <'cd /foo'>)}) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [670] ) ] spids: [670] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[683])] spids: [683] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'rel gitdir, foo'>)} {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} {(DQ (/))} {(DQ (foo/))} ) (C {(test_foobar_foo)}) (C {(test_expect_success)} {(SQ <'go to /foo/bar'>)} {(SQ <'cd /foo/bar'>)}) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [726] ) ] spids: [726] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[739])] spids: [739] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'rel gitdir, foo/bar'>)} {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} {(DQ (/))} {(DQ (foo/bar/))} ) (C {(test_foobar_foobar)}) (C {(say)} {(DQ ('GIT_DIR relative, GIT_WORK_TREE relative'))}) (C {(test_expect_success)} {(SQ <'go to /'>)} {(SQ <'cd /'>)}) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$TRASH_DIRECTORY')}) (C {(sed)} {(SQ <'s,^/,,'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [791 801] ) (/.git) ) } spids: [789] ) ] spids: [789] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(.)} spids:[811])] spids: [811] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'rel gitdir, root'>)} {(DQ ($ VSub_Name '$GIT_DIR'))} {(DQ (/))} {(DQ )}) (C {(test_foobar_root)}) (C {(test_expect_success)} {(SQ <'go to /'>)} {(SQ <'cd /foo'>)}) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [852] ) ] spids: [852] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(..)} spids:[865])] spids: [865] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'rel gitdir, foo'>)} {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} {(DQ (/))} {(DQ (foo/))} ) (C {(test_foobar_foo)}) (C {(test_expect_success)} {(SQ <'go to /foo/bar'>)} {(SQ <'cd /foo/bar'>)}) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [908] ) ] spids: [908] ) (C {(export)} {(GIT_DIR)}) ] ) (AndOr ops: [Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(../..)} spids:[921])] spids: [921] ) (C {(export)} {(GIT_WORK_TREE)}) ] ) (C {(test_vars)} {(SQ <'rel gitdir, foo/bar'>)} {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} {(DQ (/))} {(DQ (foo/bar/))} ) (C {(test_foobar_foobar)}) (C {(say)} {(DQ ('.git at root'))}) (C {(unset)} {(GIT_DIR)}) (C {(unset)} {(GIT_WORK_TREE)}) (C {(test_expect_success)} {(SQ <'go to /'>)} {(SQ <'cd /'>)}) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <'\n'> <'\trm -rf /.git &&\n'> <'\techo "Initialized empty Git repository in /.git/" > expected &&\n'> <'\tgit init > result &&\n'> <'\ttest_cmp expected result\n'> ) } ) (C {(test_vars)} {(SQ <'auto gitdir, root'>)} {(DQ (.git))} {(DQ (/))} {(DQ )}) (C {(test_foobar_root)}) (C {(test_expect_success)} {(SQ <'go to /foo'>)} {(SQ <'cd /foo'>)}) (C {(test_vars)} {(SQ <'auto gitdir, foo'>)} {(DQ (/.git))} {(DQ (/))} {(DQ (foo/))}) (C {(test_foobar_foo)}) (C {(test_expect_success)} {(SQ <'go to /foo/bar'>)} {(SQ <'cd /foo/bar'>)}) (C {(test_vars)} {(SQ <'auto gitdir, foo/bar'>)} {(DQ (/.git))} {(DQ (/))} {(DQ (foo/bar/))}) (C {(test_foobar_foobar)}) (C {(test_expect_success)} {(SQ <cleanup>)} {(SQ <'rm -rf /.git'>)}) (C {(say)} {(DQ ('auto bare gitdir'))}) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <'\n'> <'\trm -rf /refs /objects /info /hooks &&\n'> <'\trm -f /expected /ls.expected /me /result &&\n'> <'\tcd / &&\n'> <'\techo "Initialized empty Git repository in /" > expected &&\n'> <'\tgit init --bare > result &&\n'> <'\ttest_cmp expected result\n'> ) } ) (C {(test_vars)} {(SQ <'auto gitdir, root'>)} {(DQ (.))} {(DQ )} {(DQ )}) (C {(test_expect_success)} {(SQ <'go to /foo'>)} {(SQ <'cd /foo'>)}) (C {(test_vars)} {(SQ <'auto gitdir, root'>)} {(DQ (/))} {(DQ )} {(DQ )}) (C {(test_done)}) ] )