(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'test git rev-parse'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.FuncDef
      name: test_rev_parse
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:d) op:Equal rhs:(word.EmptyWord))]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:bare) op:Equal rhs:(word.EmptyWord))]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:gitdir) op:Equal rhs:(word.EmptyWord))]
            )
            (command.WhileUntil
              keyword: <KW_While while>
              cond: [(C {(Lit_Other ':')})]
              body: 
                (command.DoGroup
                  children: [
                    (command.Case
                      to_match: {(DQ ($ VSub_Number '$1'))}
                      arms: [
                        (case_arm
                          pat_list: [{(-C)}]
                          action: [
                            (command.Sentence
                              child: 
                                (command.Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (lhs_expr.LhsName name:d)
                                      op: Equal
                                      rhs: {(DQ ($ VSub_Number '$2'))}
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                            (command.Sentence
                              child: (C {(shift)})
                              terminator: <Op_Semi ';'>
                            )
                            (C {(shift)})
                          ]
                        )
                        (case_arm
                          pat_list: [{(-b)}]
                          action: [
                            (command.Case
                              to_match: {(DQ ($ VSub_Number '$2'))}
                              arms: [
                                (case_arm
                                  pat_list: [{(Lit_Other '[') (tfu) (Lit_Other ']') (Lit_Other '*')}]
                                  action: [
                                    (command.Sentence
                                      child: 
                                        (command.Assignment
                                          keyword: Assign_None
                                          pairs: [
                                            (assign_pair
                                              lhs: (lhs_expr.LhsName name:bare)
                                              op: Equal
                                              rhs: {(DQ ($ VSub_Number '$2'))}
                                            )
                                          ]
                                        )
                                      terminator: <Op_Semi ';'>
                                    )
                                    (command.Sentence
                                      child: (C {(shift)})
                                      terminator: <Op_Semi ';'>
                                    )
                                    (C {(shift)})
                                  ]
                                )
                                (case_arm
                                  pat_list: [{(Lit_Other '*')}]
                                  action: [
                                    (C {(error)} 
                                      {
                                        (DQ ("test_rev_parse: bogus core.bare value '") 
                                          ($ VSub_Number '$2') ("'")
                                        )
                                      }
                                    )
                                  ]
                                )
                              ]
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(-g)}]
                          action: [
                            (command.Sentence
                              child: 
                                (command.Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (lhs_expr.LhsName name:gitdir)
                                      op: Equal
                                      rhs: {(DQ ($ VSub_Number '$2'))}
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                            (command.Sentence
                              child: (C {(shift)})
                              terminator: <Op_Semi ';'>
                            )
                            (C {(shift)})
                          ]
                        )
                        (case_arm
                          pat_list: [{(-) (Lit_Other '*')}]
                          action: [
                            (C {(error)} 
                              {
                                (DQ ("test_rev_parse: unrecognized option '") ($ VSub_Number '$1') 
                                  ("'")
                                )
                              }
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(Lit_Other '*')}]
                          action: [(command.ControlFlow token:<ControlFlow_Break break>)]
                        )
                      ]
                    )
                  ]
                )
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:name)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (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: [Op_DAmp]
                      children: [
                        (C {(test)} {($ VSub_Pound '$#')} {(-eq)} {(0)})
                        (command.ControlFlow token:<ControlFlow_Break break>)
                      ]
                    )
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:expect)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number '$1'))}
                        )
                      ]
                    )
                    (C {(test_expect_success)} 
                      {(DQ ($ VSub_DollarName '$name') (': ') ($ 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.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:ROOT)
          op: Equal
          rhs: 
            {
              (word_part.CommandSubPart
                command_list: (command.CommandList children:[(C {(pwd)})])
                left_token: <Left_CommandSub '$('>
              )
            }
        )
      ]
    )
    (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 ($ VSub_DollarName '$ROOT') (/.git))}
    )
    (C {(test_rev_parse)} {(-C)} {(sub/dir)} {(subdirectory)} {(false)} {(false)} {(true)} {(sub/dir/)} 
      {(DQ ($ 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)})
  ]
)