(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: 'fetch handles conflicting refspecs correctly'
                  span_id: 6
                )
              )
            }
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:D)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:16)
                command_list: (command.CommandList children:[(C {(pwd)})])
              )
            }
          spids: [15]
        )
      ]
    )
    (command.ShFunction
      name: setup_repository
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp]
              children: [
                (C {(git)} {(init)} {(DQ ($ Id.VSub_Number '$1'))})
                (command.Subshell
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
                          children: [
                            (C {(cd)} {(DQ ($ Id.VSub_Number '$1'))})
                            (C {(git)} {(config)} {(remote.origin.url)} {(DQ ($ Id.VSub_DollarName '$D'))})
                            (C {(shift)})
                            (command.ForEach
                              iter_name: refspec
                              iter_words: [{(DQ ($ Id.VSub_At '$@'))}]
                              do_arg_iter: F
                              body: 
                                (command.DoGroup
                                  children: [
                                    (C {(git)} {(config)} {(--add)} {(remote.origin.fetch)} 
                                      {(DQ ($ Id.VSub_DollarName '$refspec'))}
                                    )
                                  ]
                                )
                            )
                          ]
                        )
                      ]
                    )
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: verify_stderr
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [{(cat)}]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:114)
                      fd: -1
                      arg_word: {(expected)}
                    )
                  ]
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      words: [
                        {(test_i18ngrep)}
                        {(-E)}
                        {(SQ (Token id:Id.Lit_Chars val:'^(fatal|warning):' span_id:133))}
                      ]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Less val:'<' span_id:136)
                          fd: -1
                          arg_word: {(error)}
                        )
                      ]
                    )
                    (command.Simple
                      words: [{(grep)} {(-v)} {(SQ (Token id:Id.Lit_Chars val:'hung up' span_id:146))}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Great val:'>' span_id:149)
                          fd: -1
                          arg_word: {(actual)}
                        )
                      ]
                    )
                    (C {(sort)})
                  ]
                  negated: F
                )
                (C {(test_i18ncmp)} {(expected)} {(actual)})
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:171))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:175) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit commit --allow-empty -m "Initial" &&\n'
            span_id: 176
          ) (Token id:Id.Lit_Chars val:'\tgit branch branch1 &&\n' span_id:177) 
          (Token id:Id.Lit_Chars val:'\tgit tag tag1 &&\n' span_id:178) (Token id:Id.Lit_Chars val:'\tgit commit --allow-empty -m "First" &&\n' span_id:179) 
          (Token id:Id.Lit_Chars val:'\tgit branch branch2 &&\n' span_id:180) (Token id:Id.Lit_Chars val:'\tgit tag tag2\n' span_id:181)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'fetch with no conflict' span_id:188))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:192) 
          (Token
            id: Id.Lit_Chars
            val: '\tsetup_repository ok "+refs/heads/*:refs/remotes/origin/*" && (\n'
            span_id: 193
          ) (Token id:Id.Lit_Chars val:'\t\tcd ok &&\n' span_id:194) 
          (Token id:Id.Lit_Chars val:'\t\tgit fetch origin\n' span_id:195) (Token id:Id.Lit_Chars val:'\t)\n' span_id:196)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'fetch conflict: config vs. config' span_id:203))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:207) 
          (Token id:Id.Lit_Chars val:'\tsetup_repository ccc \\\n' span_id:208) (Token id:Id.Lit_Chars val:'\t\t"+refs/heads/branch1:refs/remotes/origin/branch1" \\\n' span_id:209) 
          (Token
            id: Id.Lit_Chars
            val: '\t\t"+refs/heads/branch2:refs/remotes/origin/branch1" && (\n'
            span_id: 210
          ) (Token id:Id.Lit_Chars val:'\t\tcd ccc &&\n' span_id:211) 
          (Token
            id: Id.Lit_Chars
            val: '\t\ttest_must_fail git fetch origin 2>error &&\n'
            span_id: 212
          ) (Token id:Id.Lit_Chars val:'\t\tverify_stderr <<-\\EOF\n' span_id:213) 
          (Token
            id: Id.Lit_Chars
            val: 
'\t\tfatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1\n'
            span_id: 214
          ) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:215) (Token id:Id.Lit_Chars val:'\t)\n' span_id:216)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'fetch duplicate: config vs. config' span_id:223))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:227) 
          (Token id:Id.Lit_Chars val:'\tsetup_repository dcc \\\n' span_id:228) (Token id:Id.Lit_Chars val:'\t\t"+refs/heads/*:refs/remotes/origin/*" \\\n' span_id:229) 
          (Token
            id: Id.Lit_Chars
            val: '\t\t"+refs/heads/branch1:refs/remotes/origin/branch1" && (\n'
            span_id: 230
          ) (Token id:Id.Lit_Chars val:'\t\tcd dcc &&\n' span_id:231) 
          (Token id:Id.Lit_Chars val:'\t\tgit fetch origin\n' span_id:232) (Token id:Id.Lit_Chars val:'\t)\n' span_id:233)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'fetch conflict: arg overrides config' span_id:240))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:244) 
          (Token id:Id.Lit_Chars val:'\tsetup_repository aoc \\\n' span_id:245) (Token id:Id.Lit_Chars val:'\t\t"+refs/heads/*:refs/remotes/origin/*" && (\n' span_id:246) 
          (Token id:Id.Lit_Chars val:'\t\tcd aoc &&\n' span_id:247) 
          (Token
            id: Id.Lit_Chars
            val: '\t\tgit fetch origin refs/heads/branch2:refs/remotes/origin/branch1\n'
            span_id: 248
          ) (Token id:Id.Lit_Chars val:'\t)\n' span_id:249)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'fetch conflict: arg vs. arg' span_id:256))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:260) 
          (Token id:Id.Lit_Chars val:'\tsetup_repository caa && (\n' span_id:261) (Token id:Id.Lit_Chars val:'\t\tcd caa &&\n' span_id:262) 
          (Token
            id: Id.Lit_Chars
            val: '\t\ttest_must_fail git fetch origin \\\n'
            span_id: 263
          ) (Token id:Id.Lit_Chars val:'\t\t\trefs/heads/*:refs/remotes/origin/* \\\n' span_id:264) 
          (Token
            id: Id.Lit_Chars
            val: '\t\t\trefs/heads/branch2:refs/remotes/origin/branch1 2>error &&\n'
            span_id: 265
          ) (Token id:Id.Lit_Chars val:'\t\tverify_stderr <<-\\EOF\n' span_id:266) 
          (Token
            id: Id.Lit_Chars
            val: 
'\t\tfatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1\n'
            span_id: 267
          ) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:268) (Token id:Id.Lit_Chars val:'\t)\n' span_id:269)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'fetch conflict: criss-cross args' span_id:276))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:280) 
          (Token id:Id.Lit_Chars val:'\tsetup_repository xaa \\\n' span_id:281) (Token id:Id.Lit_Chars val:'\t\t"+refs/heads/*:refs/remotes/origin/*" && (\n' span_id:282) 
          (Token id:Id.Lit_Chars val:'\t\tcd xaa &&\n' span_id:283) (Token id:Id.Lit_Chars val:'\t\tgit fetch origin \\\n' span_id:284) 
          (Token
            id: Id.Lit_Chars
            val: '\t\t\trefs/heads/branch1:refs/remotes/origin/branch2 \\\n'
            span_id: 285
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\t\t\trefs/heads/branch2:refs/remotes/origin/branch1 2>error &&\n'
            span_id: 286
          ) (Token id:Id.Lit_Chars val:'\t\tverify_stderr <<-\\EOF\n' span_id:287) 
          (Token
            id: Id.Lit_Chars
            val: 
'\t\twarning: refs/remotes/origin/branch1 usually tracks refs/heads/branch1, not refs/heads/branch2\n'
            span_id: 288
          ) 
          (Token
            id: Id.Lit_Chars
            val: 
'\t\twarning: refs/remotes/origin/branch2 usually tracks refs/heads/branch2, not refs/heads/branch1\n'
            span_id: 289
          ) (Token id:Id.Lit_Chars val:'\t\tEOF\n' span_id:290) (Token id:Id.Lit_Chars val:'\t)\n' span_id:291)
        )
      }
    )
    (C {(test_done)})
  ]
)