(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: { (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] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: test_cmp_val body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number 1))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})] more_env: [] do_fork: T ) (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number 2))}] 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: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_vars body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (C {<test_expect_success>} {(DQ ($ Id.VSub_Number 1) <': gitdir'>)} {(SQ <'\n'> <'\t\ttest_cmp_val "'>) (DQ ($ Id.VSub_Number 2)) (SQ <'" "$(git rev-parse --git-dir)"\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ ($ Id.VSub_Number 1) <': worktree'>)} {(SQ <'\n'> <'\t\ttest_cmp_val "'>) (DQ ($ Id.VSub_Number 3)) (SQ <'" "$(git rev-parse --show-toplevel)"\n'> <'\t'>) } ) (C {<test_expect_success>} {(DQ ($ Id.VSub_Number 1) <': prefix'>)} {(SQ <'\n'> <'\t\ttest_cmp_val "'>) (DQ ($ Id.VSub_Number 4)) (SQ <'" "$(git rev-parse --show-prefix)"\n'> <'\t'>) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_foobar_root body: (BraceGroup left: <Id.Lit_LBrace '{'> 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'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_foobar_foo body: (BraceGroup left: <Id.Lit_LBrace '{'> 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'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_foobar_foobar body: (BraceGroup left: <Id.Lit_LBrace '{'> 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'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Pipeline children: [(C {<test>} {<-w>} {<'/'>})] negated: T stderr_indices: [] ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'skip_all='> name:skip_all) op: assign_op.Equal rhs: {(DQ <'Test requiring writable / skipped. Read this test if you want to run it'>)} spids: [288] ) ] redirects: [] ) (C {<test_done>}) ] spids: [275 285] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.AndOr ops: [Id.Op_DPipe Id.Op_DPipe Id.Op_DPipe Id.Op_DPipe Id.Op_DPipe Id.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.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'skip_all='> name:skip_all) op: assign_op.Equal rhs: {(DQ <'Skip test that clobbers existing files in /'>)} spids: [359] ) ] redirects: [] ) (C {<test_done>}) ] spids: [299 356] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName IKNOWWHATIAMDOING))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <YES>)} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'skip_all='> name:skip_all) op: assign_op.Equal rhs: {(DQ <'You must set env var IKNOWWHATIAMDOING=YES in order to run this test'>)} spids: [391] ) ] redirects: [] ) (C {<test_done>}) ] spids: [370 388] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Pipeline children: [(C {<test_have_prereq>} {<NOT_ROOT>})] negated: T stderr_indices: [] ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'skip_all='> name:skip_all) op: assign_op.Equal rhs: {(DQ <'No you can\'t run this as root'>)} spids: [413] ) ] redirects: [] ) (C {<test_done>}) ] spids: [402 410] ) ] else_action: [] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'ONE_SHA1='> name:ONE_SHA1) op: assign_op.Equal rhs: {<d00491fd7e5bb6fa28c517a0bb32b8b506539d4d>} spids: [424] ) ] redirects: [] ) (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.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<ls.expected>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 481 stdin_parts: [ <'100644 '> ($ Id.VSub_DollarName ONE_SHA1) <' 0\tfoo/bar/barme\n'> <'100644 '> ($ Id.VSub_DollarName ONE_SHA1) <' 0\tfoo/foome\n'> <'100644 '> ($ Id.VSub_DollarName ONE_SHA1) <' 0\tme\n'> ] ) ) ] more_env: [] do_fork: T ) (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_DollarName TRASH_DIRECTORY) <'/.git'>)} spids: [483] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<'/'>} spids: [495] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'abs gitdir, root'>)} {(DQ ($ Id.VSub_DollarName 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 ($ Id.VSub_DollarName 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 ($ Id.VSub_DollarName 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: [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 (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName TRASH_DIRECTORY)}) (C {<sed>} {(SQ <'s,^/,,'>)}) ] negated: F stderr_indices: [] ) right: <Id.Eof_RParen _> ) <'/.git'> ) } spids: [607] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<'/'>} spids: [629] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'rel gitdir, root'>)} {(DQ ($ Id.VSub_DollarName GIT_DIR))} {(DQ <'/'>)} {(DQ )}) (C {<test_foobar_root>}) (C {<test_expect_success>} {(SQ <'go to /foo'>)} {(SQ <'cd /foo'>)}) (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_DollarName TRASH_DIRECTORY) <'/.git'>)} spids: [670] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<'/'>} spids: [683] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'rel gitdir, foo'>)} {(DQ ($ Id.VSub_DollarName 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: [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_DollarName TRASH_DIRECTORY) <'/.git'>)} spids: [726] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<'/'>} spids: [739] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'rel gitdir, foo/bar'>)} {(DQ ($ Id.VSub_DollarName 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: [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 (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName TRASH_DIRECTORY)}) (C {<sed>} {(SQ <'s,^/,,'>)}) ] negated: F stderr_indices: [] ) right: <Id.Eof_RParen _> ) <'/.git'> ) } spids: [789] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<.>} spids: [811] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'rel gitdir, root'>)} {(DQ ($ Id.VSub_DollarName GIT_DIR))} {(DQ <'/'>)} {(DQ )}) (C {<test_foobar_root>}) (C {<test_expect_success>} {(SQ <'go to /'>)} {(SQ <'cd /foo'>)}) (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_DollarName TRASH_DIRECTORY) <'/.git'>)} spids: [852] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<..>} spids: [865] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'rel gitdir, foo'>)} {(DQ ($ Id.VSub_DollarName 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: [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_DollarName TRASH_DIRECTORY) <'/.git'>)} spids: [908] ) ] redirects: [] ) (C {<export>} {<GIT_DIR>}) ] ) (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: {<'../..'>} spids: [921] ) ] redirects: [] ) (C {<export>} {<GIT_WORK_TREE>}) ] ) (C {<test_vars>} {(SQ <'rel gitdir, foo/bar'>)} {(DQ ($ Id.VSub_DollarName 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>}) ] )