(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[12]) 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: [12] ) ] spids: [12] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: test_cmp_val body: (command.BraceGroup children: [ (command.SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$1'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)})] ) (command.SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$2'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(result)})] ) (C {(test_cmp)} {(expected)} {(result)}) ] spids: [33] ) spids: [29 32] ) (command.FuncDef name: test_vars body: (command.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: [71] ) spids: [67 70] ) (command.FuncDef name: test_foobar_root body: (command.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: [142] ) spids: [138 141] ) (command.FuncDef name: test_foobar_foo body: (command.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: [191] ) spids: [187 190] ) (command.FuncDef name: test_foobar_foobar body: (command.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: [239] ) spids: [235 238] ) (command.If arms: [ (if_arm cond: [(command.Pipeline children:[(C {(test)} {(-w)} {(/)})] negated:T)] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:skip_all spids:[296]) op: Equal rhs: { (DQ ('Test requiring writable / skipped. Read this test if you want to run it')) } spids: [296] ) ] spids: [296] ) (C {(test_done)}) ] spids: [16777215 293] ) ] spids: [16777215 304] ) (command.If arms: [ (if_arm cond: [ (command.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: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:skip_all spids:[367]) op: Equal rhs: {(DQ ('Skip test that clobbers existing files in /'))} spids: [367] ) ] spids: [367] ) (C {(test_done)}) ] spids: [16777215 364] ) ] spids: [16777215 375] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$IKNOWWHATIAMDOING'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (YES))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:skip_all spids:[399]) op: Equal rhs: {(DQ ('You must set env var IKNOWWHATIAMDOING=YES in order to run this test'))} spids: [399] ) ] spids: [399] ) (C {(test_done)}) ] spids: [16777215 396] ) ] spids: [16777215 407] ) (command.If arms: [ (if_arm cond: [(command.Pipeline children:[(C {(test_have_prereq)} {(NOT_ROOT)})] negated:T)] action: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:skip_all spids:[421]) op: Equal rhs: {(DQ ("No you can't run this as root"))} spids: [421] ) ] spids: [421] ) (C {(test_done)}) ] spids: [16777215 418] ) ] spids: [16777215 429] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:ONE_SHA1 spids:[432]) op: Equal rhs: {(d00491fd7e5bb6fa28c517a0bb32b8b506539d4d)} spids: [432] ) ] spids: [432] ) (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 /'>)}) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(ls.expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 489 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') ] ) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[491]) op: Equal rhs: {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [491] ) ] spids: [491] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[503]) op: Equal rhs: {(/)} spids: [503] ) ] spids: [503] ) (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 /'>)}) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[615]) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ VSub_Name '$TRASH_DIRECTORY')}) (C {(sed)} {(SQ <'s,^/,,'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [617 627] ) (/.git) ) } spids: [615] ) ] spids: [615] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[637]) op: Equal rhs: {(/)} spids: [637] ) ] spids: [637] ) (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'>)}) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[678]) op: Equal rhs: {(DQ (../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [678] ) ] spids: [678] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[691]) op: Equal rhs: {(/)} spids: [691] ) ] spids: [691] ) (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'>)}) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[734]) op: Equal rhs: {(DQ (../../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [734] ) ] spids: [734] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[747]) op: Equal rhs: {(/)} spids: [747] ) ] spids: [747] ) (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 /'>)}) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[797]) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {($ VSub_Name '$TRASH_DIRECTORY')}) (C {(sed)} {(SQ <'s,^/,,'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [799 809] ) (/.git) ) } spids: [797] ) ] spids: [797] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[819]) op: Equal rhs: {(.)} spids: [819] ) ] spids: [819] ) (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'>)}) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[860]) op: Equal rhs: {(DQ (../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [860] ) ] spids: [860] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[873]) op: Equal rhs: {(..)} spids: [873] ) ] spids: [873] ) (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'>)}) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_DIR spids:[916]) op: Equal rhs: {(DQ (../../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [916] ) ] spids: [916] ) (C {(export)} {(GIT_DIR)}) ] ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:GIT_WORK_TREE spids:[929]) op: Equal rhs: {(../..)} spids: [929] ) ] spids: [929] ) (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)}) ] )