(command.CommandList
  children: [
    (command.Sentence
      child: 
        (command.AndOr
          ops: [Op_DPipe]
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:GIT_DIR)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(rev-parse)} {(-q)} {(--git-dir)})]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (C {(Lit_Other ':')})
          ]
        )
      terminator: <Op_Semi ';'>
    )
    (command.FuncDef
      name: get_default_remote
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:curr_branch)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(symbolic-ref)} {(-q)} {(HEAD)})]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:curr_branch)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (word_part.BracedVarSub
                          token: <VSub_Name curr_branch>
                          suffix_op: 
                            (suffix_op.StringUnary
                              op_id: VOp1_Pound
                              arg_word: {(refs) (Lit_Slash /) (heads) (Lit_Slash /)}
                            )
                        )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:origin)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (C {(git)} {(config)} {(--get)} 
                                {(DQ (branch.) ($ VSub_DollarName '$curr_branch') (.remote))}
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (C {(echo)} 
              {
                (word_part.BracedVarSub
                  token: <VSub_Name origin>
                  suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:{(origin)})
                )
              }
            )
          ]
        )
    )
    (command.FuncDef
      name: get_remote_merge_branch
      body: 
        (command.BraceGroup
          children: [
            (command.Case
              to_match: {(DQ ($ VSub_Pound '$#'))}
              arms: [
                (case_arm
                  pat_list: [{(0)} {(1)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:origin)
                          op: Equal
                          rhs: {(DQ ($ VSub_Number '$1'))}
                        )
                      ]
                    )
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:default)
                          op: Equal
                          rhs: 
                            {
                              (word_part.CommandSubPart
                                command_list: 
                                  (command.CommandList
                                    children: [(C {(get_default_remote)})]
                                  )
                                left_token: <Left_CommandSub '$('>
                              )
                            }
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(test)} {(-z)} {(DQ ($ VSub_DollarName '$origin'))})
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:origin)
                              op: Equal
                              rhs: {($ VSub_DollarName '$default')}
                            )
                          ]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Op_DAmp Op_DAmp]
                      children: [
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:curr_branch)
                              op: Equal
                              rhs: 
                                {
                                  (word_part.CommandSubPart
                                    command_list: 
                                      (command.CommandList
                                        children: [(C {(git)} {(symbolic-ref)} {(-q)} {(HEAD)})]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                  )
                                }
                            )
                          ]
                        )
                        (C {(Lit_Other '[')} {(DQ ($ VSub_DollarName '$origin'))} {(Lit_Other '=')} 
                          {(DQ ($ VSub_DollarName '$default'))} {(Lit_Other ']')}
                        )
                        (C {(echo)} 
                          {
                            (word_part.CommandSubPart
                              command_list: 
                                (command.CommandList
                                  children: [
                                    (C {(git)} {(for-each-ref)} 
                                      {(--format) (Lit_Other '=') (SQ <'%(upstream)'>)} {($ VSub_DollarName '$curr_branch')}
                                    )
                                  ]
                                )
                              left_token: <Left_CommandSub '$('>
                            )
                          }
                        )
                      ]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:repo)
                          op: Equal
                          rhs: {($ VSub_Number '$1')}
                        )
                      ]
                    )
                    (C {(shift)})
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:ref)
                          op: Equal
                          rhs: {($ VSub_Number '$1')}
                        )
                      ]
                    )
                    (command.Case
                      to_match: {(DQ ($ VSub_DollarName '$ref'))}
                      arms: [
                        (case_arm
                          pat_list: [{(Lit_Other '+') (Lit_Other '*')}]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:ref)
                                  op: Equal
                                  rhs: 
                                    {
                                      (word_part.CommandSubPart
                                        command_list: 
                                          (command.CommandList
                                            children: [
                                              (C {(expr)} {(DQ (z) ($ VSub_DollarName '$ref'))} 
                                                {(Lit_Other ':')} {(SQ <'z+\\(.*\\)'>)}
                                              )
                                            ]
                                          )
                                        left_token: <Left_CommandSub '$('>
                                      )
                                    }
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Op_DPipe]
                      children: [
                        (command.SimpleCommand
                          words: [
                            {(expr)}
                            {(DQ (z) ($ VSub_DollarName '$ref'))}
                            {(Lit_Other ':')}
                            {(SQ <'z.*:'>)}
                          ]
                          redirects: [
                            (redir.Redir
                              op: <Redir_Great '>'>
                              fd: 16777215
                              arg_word: {(/dev/null)}
                            )
                          ]
                        )
                        (command.Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (lhs_expr.LhsName name:ref)
                              op: Equal
                              rhs: {(DQ (${ VSub_Name ref) (':'))}
                            )
                          ]
                        )
                      ]
                    )
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:remote)
                          op: Equal
                          rhs: 
                            {
                              (word_part.CommandSubPart
                                command_list: 
                                  (command.CommandList
                                    children: [
                                      (C {(expr)} {(DQ (z) ($ VSub_DollarName '$ref'))} 
                                        {(Lit_Other ':')} {(SQ <'z\\([^:]*\\):'>)}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                              )
                            }
                        )
                      ]
                    )
                    (command.Case
                      to_match: {(DQ ($ VSub_DollarName '$remote'))}
                      arms: [
                        (case_arm
                          pat_list: [{(SQ )} {(HEAD)}]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:remote)
                                  op: Equal
                                  rhs: {(HEAD)}
                                )
                              ]
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(heads/) (Lit_Other '*')}]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:remote)
                                  op: Equal
                                  rhs: 
                                    {
                                      (word_part.BracedVarSub
                                        token: <VSub_Name remote>
                                        suffix_op: 
                                          (suffix_op.StringUnary
                                            op_id: VOp1_Pound
                                            arg_word: {(heads) (Lit_Slash /)}
                                          )
                                      )
                                    }
                                )
                              ]
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [{(refs/heads/) (Lit_Other '*')}]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (lhs_expr.LhsName name:remote)
                                  op: Equal
                                  rhs: 
                                    {
                                      (word_part.BracedVarSub
                                        token: <VSub_Name remote>
                                        suffix_op: 
                                          (suffix_op.StringUnary
                                            op_id: VOp1_Pound
                                            arg_word: {(refs) (Lit_Slash /) (heads) (Lit_Slash /)}
                                          )
                                      )
                                    }
                                )
                              ]
                            )
                          ]
                        )
                        (case_arm
                          pat_list: [
                            {(refs/) (Lit_Other '*')}
                            {(tags/) (Lit_Other '*')}
                            {(remotes/) (Lit_Other '*')}
                          ]
                          action: [
                            (command.Assignment
                              keyword: Assign_None
                              pairs: [(assign_pair lhs:(lhs_expr.LhsName name:remote) op:Equal rhs:(word.EmptyWord))]
                            )
                          ]
                        )
                      ]
                    )
                    (command.AndOr
                      ops: [Op_DAmp]
                      children: [
                        (C {(Lit_Other '[')} {(-n)} {(DQ ($ VSub_DollarName '$remote'))} 
                          {(Lit_Other ']')}
                        )
                        (command.Case
                          to_match: {(DQ ($ VSub_DollarName '$repo'))}
                          arms: [
                            (case_arm
                              pat_list: [{(.)}]
                              action: [(C {(echo)} {(DQ (refs/heads/) ($ VSub_DollarName '$remote'))})]
                            )
                            (case_arm
                              pat_list: [{(Lit_Other '*')}]
                              action: [
                                (C {(echo)} 
                                  {
                                    (DQ (refs/remotes/) ($ VSub_DollarName '$repo') (/) 
                                      ($ VSub_DollarName '$remote')
                                    )
                                  }
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: error_on_missing_default_upstream
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:cmd)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$1'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:op_type)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$2'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:op_prep)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$3'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:example)
                  op: Equal
                  rhs: {(DQ ($ VSub_Number '$4'))}
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:branch_name)
                  op: Equal
                  rhs: 
                    {
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(git)} {(symbolic-ref)} {(-q)} {(HEAD)})]
                          )
                        left_token: <Left_CommandSub '$('>
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:display_branch_name)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (word_part.BracedVarSub
                          token: <VSub_Name branch_name>
                          suffix_op: 
                            (suffix_op.StringUnary
                              op_id: VOp1_Pound
                              arg_word: {(refs) (Lit_Slash /) (heads) (Lit_Slash /)}
                            )
                        )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:remote)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (word_part.CommandSubPart
                          command_list: 
                            (command.CommandList
                              children: [(C {(gettext)} {(DQ ('<remote>'))})]
                            )
                          left_token: <Left_CommandSub '$('>
                        )
                      )
                    }
                )
              ]
            )
            (command.Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:branch)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (word_part.CommandSubPart
                          command_list: 
                            (command.CommandList
                              children: [(C {(gettext)} {(DQ ('<branch>'))})]
                            )
                          left_token: <Left_CommandSub '$('>
                        )
                      )
                    }
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(test)} 
                      {
                        (word_part.CommandSubPart
                          command_list: 
                            (command.CommandList
                              children: [
                                (command.Pipeline
                                  children: [(C {(git)} {(remote)}) (C {(wc)} {(-l)})]
                                  negated: F
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                        )
                      } {(Lit_Other '=')} {(1)}
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:remote)
                          op: Equal
                          rhs: 
                            {
                              (word_part.CommandSubPart
                                command_list: (command.CommandList children:[(C {(git)} {(remote)})])
                                left_token: <Left_CommandSub '$('>
                              )
                            }
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-z)} {(DQ ($ VSub_DollarName '$branch_name'))})]
                  action: [(C {(gettextln)} {(DQ ('You are not currently on a branch.'))})]
                )
              ]
              else_action: [
                (C {(gettextln)} {(DQ ('There is no tracking information for the current branch.'))})
              ]
            )
            (command.Case
              to_match: {(DQ ($ VSub_DollarName '$op_type'))}
              arms: [
                (case_arm
                  pat_list: [{(rebase)}]
                  action: [
                    (C {(gettextln)} {(DQ ('Please specify which branch you want to rebase against.'))})
                  ]
                )
                (case_arm
                  pat_list: [{(merge)}]
                  action: [
                    (C {(gettextln)} {(DQ ('Please specify which branch you want to merge with.'))})
                  ]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (command.SimpleCommand
                      words: [
                        {(echo)}
                        {(DQ ('BUG: unknown operation type: ') ($ VSub_DollarName '$op_type'))}
                      ]
                      redirects: [(redir.Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
                    )
                    (command.ControlFlow
                      token: <ControlFlow_Exit exit>
                      arg_word: {(1)}
                    )
                  ]
                )
              ]
            )
            (C {(eval_gettextln)} 
              {
                (DQ ('See git-') (word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>) 
                  ('{cmd}(1) for details.')
                )
              }
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('    ') ($ VSub_DollarName '$example'))})
            (C {(echo)})
            (command.If
              arms: [
                (if_arm
                  cond: [(C {(test)} {(-n)} {(DQ ($ VSub_DollarName '$branch_name'))})]
                  action: [
                    (C {(gettextln)} 
                      {
                        (DQ 
                          (
'If you wish to set tracking information for this branch you can do so with:'
                          )
                        )
                      }
                    )
                    (C {(echo)})
                    (C {(echo)} 
                      {
                        (DQ ('    git branch --set-upstream-to=') ($ VSub_DollarName '$remote') (/) 
                          ($ VSub_DollarName '$branch') (' ') ($ VSub_DollarName '$display_branch_name')
                        )
                      }
                    )
                    (C {(echo)})
                  ]
                )
              ]
            )
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
  ]
)