(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'git remote group handling'>)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: mark
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Number '$1'))}]
              redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(mark)} spids:[27])]
            )
          ]
          spids: [18]
        )
      spids: [14 17]
    )
    (FuncDef
      name: update_repo
      body: 
        (BraceGroup
          children: [
            (Subshell
              child: 
                (AndOr
                  children: [
                    (C {(cd)} {($ VSub_Number '$1')})
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [{(echo)} {(content)}]
                          redirects: [
                            (Redir
                              op_id: Redir_DGreat
                              fd: 16777215
                              arg_word: {(file)}
                              spids: [52]
                            )
                          ]
                        )
                        (AndOr
                          children: [
                            (C {(git)} {(add)} {(file)})
                            (C {(git)} {(commit)} {(-F)} {(../mark)})
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              spids: [40 74]
            )
          ]
          spids: [37]
        )
      spids: [33 36]
    )
    (FuncDef
      name: update_repos
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(update_repo)} {(one)} {($ VSub_Number '$1')})
                (C {(update_repo)} {(two)} {($ VSub_Number '$1')})
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [83]
        )
      spids: [79 82]
    )
    (FuncDef
      name: repo_fetched
      body: 
        (BraceGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(test)} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(git)} {(log)} {(-1)} 
                                        {(--pretty) (Lit_Other '=') (format) (Lit_Other ':') 
                                          (Lit_Other '%') (s)
                                        } {($ VSub_Number '$1')} {(--)}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [116 133]
                              )
                            )
                          } {(Lit_Other '=')} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: (CommandList children:[(C {(cat)} {(mark)})])
                                left_token: <Left_CommandSub '$('>
                                spids: [139 143]
                              )
                            )
                          }
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (SimpleCommand
                      words: [{(echo)} {(DQ ('repo was fetched: ') ($ VSub_Number '$1'))}]
                      redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[152])]
                    )
                    (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})
                  ]
                  spids: [16777215 147]
                )
              ]
              spids: [16777215 166]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('repo was not fetched: ') ($ VSub_Number '$1'))}]
              redirects: [(Redir op_id:Redir_GreatAnd fd:16777215 arg_word:{(2)} spids:[171])]
            )
            (ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})
          ]
          spids: [108]
        )
      spids: [104 107]
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tmkdir one && (cd one && git init) &&\n'> 
          <'\tmkdir two && (cd two && git init) &&\n'> <'\tgit remote add -m master one one &&\n'> <'\tgit remote add -m master two two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'no group updates all'>)} 
      {
        (SQ <'\n'> <'\tmark update-all &&\n'> <'\tupdate_repos &&\n'> <'\tgit remote update &&\n'> 
          <'\trepo_fetched one &&\n'> <'\trepo_fetched two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'nonexistent group produces error'>)} 
      {
        (SQ <'\n'> <'\tmark nonexistent &&\n'> <'\tupdate_repos &&\n'> 
          <'\ttest_must_fail git remote update nonexistent &&\n'> <'\t! repo_fetched one &&\n'> <'\t! repo_fetched two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'updating group updates all members (remote update)'>)} 
      {
        (SQ <'\n'> <'\tmark group-all &&\n'> <'\tupdate_repos &&\n'> 
          <'\tgit config --add remotes.all one &&\n'> <'\tgit config --add remotes.all two &&\n'> <'\tgit remote update all &&\n'> 
          <'\trepo_fetched one &&\n'> <'\trepo_fetched two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'updating group updates all members (fetch)'>)} 
      {
        (SQ <'\n'> <'\tmark fetch-group-all &&\n'> <'\tupdate_repos &&\n'> <'\tgit fetch all &&\n'> 
          <'\trepo_fetched one &&\n'> <'\trepo_fetched two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'updating group does not update non-members (remote update)'>)} 
      {
        (SQ <'\n'> <'\tmark group-some &&\n'> <'\tupdate_repos &&\n'> 
          <'\tgit config --add remotes.some one &&\n'> <'\tgit remote update some &&\n'> <'\trepo_fetched one &&\n'> <'\t! repo_fetched two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'updating group does not update non-members (fetch)'>)} 
      {
        (SQ <'\n'> <'\tmark fetch-group-some &&\n'> <'\tupdate_repos &&\n'> 
          <'\tgit config --add remotes.some one &&\n'> <'\tgit remote update some &&\n'> <'\trepo_fetched one &&\n'> <'\t! repo_fetched two\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'updating remote name updates that remote'>)} 
      {
        (SQ <'\n'> <'\tmark remote-name &&\n'> <'\tupdate_repos &&\n'> <'\tgit remote update one &&\n'> 
          <'\trepo_fetched one &&\n'> <'\t! repo_fetched two\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)