(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'test git rev-parse' span_id:6))} spids: [4] ) ] ) (C {(.)} {(./test-lib.sh)}) (command.ShFunction name: test_rev_parse body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:d) op: assign_op.Equal rhs: (word.Empty) spids: [25] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:bare) op: assign_op.Equal rhs: (word.Empty) spids: [28] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:gitdir) op: assign_op.Equal rhs: (word.Empty) spids: [31] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:34) cond: [(C {(Id.Lit_Other ':')})] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(-C)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:d) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [54] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:58) ) (command.Sentence child: (C {(shift)}) terminator: (Token id:Id.Op_Semi val:';' span_id:61) ) (C {(shift)}) ] spids: [51 52 65 -1] ) (case_arm pat_list: [{(-b)}] action: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$2'))} arms: [ (case_arm pat_list: [ {(Id.Lit_LBracket '[') (tfu) (Id.Lit_RBracket ']') (Id.Lit_Star '*') } ] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:bare) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [86] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:90) ) (command.Sentence child: (C {(shift)}) terminator: (Token id:Id.Op_Semi val:';' span_id:93) ) (C {(shift)}) ] spids: [80 84 97 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(error)} { (DQ ("test_rev_parse: bogus core.bare value '") ($ Id.VSub_Number '$2') ("'") ) } ) ] spids: [100 101 111 -1] ) ] ) ] spids: [68 69 116 -1] ) (case_arm pat_list: [{(-g)}] action: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:gitdir) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$2'))} spids: [122] ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:126) ) (command.Sentence child: (C {(shift)}) terminator: (Token id:Id.Op_Semi val:';' span_id:129) ) (C {(shift)}) ] spids: [119 120 133 -1] ) (case_arm pat_list: [{(-) (Id.Lit_Star '*')}] action: [ (C {(error)} { (DQ ("test_rev_parse: unrecognized option '") ($ Id.VSub_Number '$1') ("'") ) } ) ] spids: [136 138 148 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:154) ) ] spids: [151 152 156 -1] ) ] ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [166] ) ] ) (C {(shift)}) (command.ForEach iter_name: o iter_words: [ {(--is-bare-repository)} {(--is-inside-git-dir)} {(--is-inside-work-tree)} {(--show-prefix)} {(--git-dir)} ] do_arg_iter: F body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {($ Id.VSub_Pound '$#')} {(-eq)} {(0)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:212) ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:expect) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [215] ) ] ) (C {(test_expect_success)} {(DQ ($ Id.VSub_DollarName '$name') (': ') ($ Id.VSub_DollarName '$o'))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:230) (Token id: Id.Lit_Chars val: '\t\t\tif test -n "$gitdir"\n' span_id: 231 ) (Token id:Id.Lit_Chars val:'\t\t\tthen\n' span_id:232) (Token id: Id.Lit_Chars val: '\t\t\t\ttest_when_finished "unset GIT_DIR" &&\n' span_id: 233 ) (Token id:Id.Lit_Chars val:'\t\t\t\tGIT_DIR="$gitdir" &&\n' span_id:234) (Token id: Id.Lit_Chars val: '\t\t\t\texport GIT_DIR\n' span_id: 235 ) (Token id:Id.Lit_Chars val:'\t\t\tfi &&\n' span_id:236) (Token id:Id.Lit_Chars val:'\n' span_id:237) (Token id: Id.Lit_Chars val: '\t\t\tcase "$bare" in\n' span_id: 238 ) (Token id: Id.Lit_Chars val: '\t\t\tt*) test_config ${d:+-C} ${d:+"$d"} core.bare true ;;\n' span_id: 239 ) (Token id: Id.Lit_Chars val: '\t\t\tf*) test_config ${d:+-C} ${d:+"$d"} core.bare false ;;\n' span_id: 240 ) (Token id:Id.Lit_Chars val:'\t\t\tu*) test_unconfig ${d:+-C} ${d:+"$d"} core.bare ;;\n' span_id:241) (Token id: Id.Lit_Chars val: '\t\t\tesac &&\n' span_id: 242 ) (Token id:Id.Lit_Chars val:'\n' span_id:243) (Token id: Id.Lit_Chars val: '\t\t\techo "$expect" >expect &&\n' span_id: 244 ) (Token id:Id.Lit_Chars val:'\t\t\tgit ${d:+-C} ${d:+"$d"} rev-parse $o >actual &&\n' span_id:245) (Token id: Id.Lit_Chars val: '\t\t\ttest_cmp expect actual\n' span_id: 246 ) (Token id:Id.Lit_Chars val:'\t\t' span_id:247) ) } ) (C {(shift)}) ] ) ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ROOT) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:260) command_list: (command.CommandList children:[(C {(pwd)})]) ) } spids: [259] ) ] ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:268))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:272) (Token id:Id.Lit_Chars val:'\tmkdir -p sub/dir work &&\n' span_id:273) (Token id:Id.Lit_Chars val:'\tcp -R .git repo.git\n' span_id:274) ) } ) (C {(test_rev_parse)} {(toplevel)} {(false)} {(false)} {(true)} {(SQ )} {(.git)}) (C {(test_rev_parse)} {(-C)} {(.git)} {(.git/)} {(false)} {(true)} {(false)} {(SQ )} {(.)}) (C {(test_rev_parse)} {(-C)} {(.git/objects)} {(.git/objects/)} {(false)} {(true)} {(false)} {(SQ )} {(DQ ($ Id.VSub_DollarName '$ROOT') (/.git))} ) (C {(test_rev_parse)} {(-C)} {(sub/dir)} {(subdirectory)} {(false)} {(false)} {(true)} {(sub/dir/)} {(DQ ($ Id.VSub_DollarName '$ROOT') (/.git))} ) (C {(test_rev_parse)} {(-b)} {(t)} {(SQ (Token id:Id.Lit_Chars val:'core.bare = true' span_id:365))} {(true)} {(false)} {(false)} ) (C {(test_rev_parse)} {(-b)} {(u)} {(SQ (Token id:Id.Lit_Chars val:'core.bare undefined' span_id:382))} {(false)} {(false)} {(true)} ) (C {(test_rev_parse)} {(-C)} {(work)} {(-g)} {(../.git)} {(-b)} {(f)} {(SQ (Token id:Id.Lit_Chars val:'GIT_DIR=../.git, core.bare = false' span_id:408))} {(false)} {(false)} {(true)} {(SQ )} ) (C {(test_rev_parse)} {(-C)} {(work)} {(-g)} {(../.git)} {(-b)} {(t)} {(SQ (Token id:Id.Lit_Chars val:'GIT_DIR=../.git, core.bare = true' span_id:436))} {(true)} {(false)} {(false)} {(SQ )} ) (C {(test_rev_parse)} {(-C)} {(work)} {(-g)} {(../.git)} {(-b)} {(u)} {(SQ (Token id:Id.Lit_Chars val:'GIT_DIR=../.git, core.bare undefined' span_id:464))} {(false)} {(false)} {(true)} {(SQ )} ) (C {(test_rev_parse)} {(-C)} {(work)} {(-g)} {(../repo.git)} {(-b)} {(f)} {(SQ (Token id:Id.Lit_Chars val:'GIT_DIR=../repo.git, core.bare = false' span_id:493))} {(false)} {(false)} {(true)} {(SQ )} ) (C {(test_rev_parse)} {(-C)} {(work)} {(-g)} {(../repo.git)} {(-b)} {(t)} {(SQ (Token id:Id.Lit_Chars val:'GIT_DIR=../repo.git, core.bare = true' span_id:521))} {(true)} {(false)} {(false)} {(SQ )} ) (C {(test_rev_parse)} {(-C)} {(work)} {(-g)} {(../repo.git)} {(-b)} {(u)} {(SQ (Token id:Id.Lit_Chars val:'GIT_DIR=../repo.git, core.bare undefined' span_id:549))} {(false)} {(false)} {(true)} {(SQ )} ) (C {(test_done)}) ] )