(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_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[34])] ) (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Number '$2'))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(result)} spids:[45])] ) (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:True)] 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: [-1 285] ) ] spids: [-1 296] ) (If arms: [ (if_arm cond: [ (AndOr children: [ (C {(test)} {(-e)} {(/refs)}) (AndOr children: [ (C {(test)} {(-e)} {(/objects)}) (AndOr children: [ (C {(test)} {(-e)} {(/info)}) (AndOr children: [ (C {(test)} {(-e)} {(/hooks)}) (AndOr children: [ (C {(test)} {(-e)} {(/.git)}) (AndOr children: [(C {(test)} {(-e)} {(/foo)}) (C {(test)} {(-e)} {(/me)})] op_id: Op_DPipe ) ] op_id: Op_DPipe ) ] op_id: Op_DPipe ) ] op_id: Op_DPipe ) ] op_id: Op_DPipe ) ] op_id: Op_DPipe ) ] 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: [-1 356] ) ] spids: [-1 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: [-1 388] ) ] spids: [-1 399] ) (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test_have_prereq)} {(NOT_ROOT)})] negated:True)] 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: [-1 410] ) ] spids: [-1 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_id:Redir_Great fd:-1 arg_word:{(ls.expected)} spids:[465]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ('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') ) } do_expansion: True here_end: EOF was_filled: True spids: [468] ) ] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [481] ) ] spids: [481] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[493])] spids: [493] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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 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: False ) ] ) left_token: <Left_CommandSub '$('> spids: [607 617] ) (/.git) ) } spids: [605] ) ] spids: [605] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[627])] spids: [627] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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 children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [668] ) ] spids: [668] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[681])] spids: [681] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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 children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [724] ) ] spids: [724] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(/)} spids:[737])] spids: [737] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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 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: False ) ] ) left_token: <Left_CommandSub '$('> spids: [789 799] ) (/.git) ) } spids: [787] ) ] spids: [787] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(.)} spids:[809])] spids: [809] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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 children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [850] ) ] spids: [850] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(..)} spids:[863])] spids: [863] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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 children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GIT_DIR) op: Equal rhs: {(DQ (../../) ($ VSub_Name '$TRASH_DIRECTORY') (/.git))} spids: [906] ) ] spids: [906] ) (C {(export)} {(GIT_DIR)}) ] op_id: Op_DAmp ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_WORK_TREE) op:Equal rhs:{(../..)} spids:[919])] spids: [919] ) (C {(export)} {(GIT_WORK_TREE)}) ] op_id: Op_DAmp ) (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)}) ] )