(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'test git rev-parse'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: test_rev_parse
      body: 
        (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: <Id.KW_While while>
              cond: (condition.Shell commands:[(C {<Id.Lit_Colon ':'>})])
              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: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: (C {<shift>})
                              terminator: <Id.Op_Semi _>
                            )
                            (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: <Id.Op_Semi _>
                                    )
                                    (command.Sentence
                                      child: (C {<shift>})
                                      terminator: <Id.Op_Semi _>
                                    )
                                    (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: <Id.Op_Semi _>
                            )
                            (command.Sentence
                              child: (C {<shift>})
                              terminator: <Id.Op_Semi _>
                            )
                            (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:<Id.ControlFlow_Break break>)]
                          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: <Id.ControlFlow_Break break>
                        )
                      ]
                    )
                    (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 <'\n'> <'\t\t\tif test -n "$gitdir"\n'> <'\t\t\tthen\n'> 
                          <'\t\t\t\ttest_when_finished "unset GIT_DIR" &&\n'> <'\t\t\t\tGIT_DIR="$gitdir" &&\n'> <'\t\t\t\texport GIT_DIR\n'> <'\t\t\tfi &&\n'> <'\n'> 
                          <'\t\t\tcase "$bare" in\n'> <'\t\t\tt*) test_config ${d:+-C} ${d:+"$d"} core.bare true ;;\n'> 
                          <'\t\t\tf*) test_config ${d:+-C} ${d:+"$d"} core.bare false ;;\n'> <'\t\t\tu*) test_unconfig ${d:+-C} ${d:+"$d"} core.bare ;;\n'> <'\t\t\tesac &&\n'> <'\n'> 
                          <'\t\t\techo "$expect" >expect &&\n'> <'\t\t\tgit ${d:+-C} ${d:+"$d"} rev-parse $o >actual &&\n'> <'\t\t\ttest_cmp expect actual\n'> <'\t\t'>
                        )
                      }
                    )
                    (C {<shift>})
                  ]
                )
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:ROOT)
          op: assign_op.Equal
          rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<pwd>}))}
          spids: [259]
        )
      ]
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {(SQ <'\n'> <'\tmkdir -p sub/dir work &&\n'> <'\tcp -R .git repo.git\n'>)}
    )
    (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 <'core.bare = true'>)} {<true>} {<false>} {<false>})
    (C {<test_rev_parse>} {<-b>} {<u>} {(SQ <'core.bare undefined'>)} {<false>} {<false>} {<true>})
    (C {<test_rev_parse>} {<-C>} {<work>} {<-g>} {<'../.git'>} {<-b>} {<f>} 
      {(SQ <'GIT_DIR=../.git, core.bare = false'>)} {<false>} {<false>} {<true>} {(SQ )}
    )
    (C {<test_rev_parse>} {<-C>} {<work>} {<-g>} {<'../.git'>} {<-b>} {<t>} 
      {(SQ <'GIT_DIR=../.git, core.bare = true'>)} {<true>} {<false>} {<false>} {(SQ )}
    )
    (C {<test_rev_parse>} {<-C>} {<work>} {<-g>} {<'../.git'>} {<-b>} {<u>} 
      {(SQ <'GIT_DIR=../.git, core.bare undefined'>)} {<false>} {<false>} {<true>} {(SQ )}
    )
    (C {<test_rev_parse>} {<-C>} {<work>} {<-g>} {<'../repo.git'>} {<-b>} {<f>} 
      {(SQ <'GIT_DIR=../repo.git, core.bare = false'>)} {<false>} {<false>} {<true>} {(SQ )}
    )
    (C {<test_rev_parse>} {<-C>} {<work>} {<-g>} {<'../repo.git'>} {<-b>} {<t>} 
      {(SQ <'GIT_DIR=../repo.git, core.bare = true'>)} {<true>} {<false>} {<false>} {(SQ )}
    )
    (C {<test_rev_parse>} {<-C>} {<work>} {<-g>} {<'../repo.git'>} {<-b>} {<u>} 
      {(SQ <'GIT_DIR=../repo.git, core.bare undefined'>)} {<false>} {<false>} {<true>} {(SQ )}
    )
    (C {<test_done>})
  ]
)