(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description spids:[4])
          op: Equal
          rhs: {(SQ <'git rebase - test patch id computation'>)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: count
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:i spids:[23]) op:Equal rhs:{(0)} spids:[23])]
              spids: [23]
            )
            (WhileUntil
              keyword: <KW_While while>
              cond: [(C {(test)} {($ VSub_Name '$i')} {(-lt)} {($ VSub_Number '$1')})]
              body: 
                (DoGroup
                  children: [
                    (C {(echo)} {(DQ ($ VSub_Name '$i'))})
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:i spids:[48])
                          op: Equal
                          rhs: 
                            {
                              (ArithSubPart
                                anode: 
                                  (ArithBinary
                                    op_id: Arith_Plus
                                    left: (ArithWord w:{($ VSub_Name '$i')})
                                    right: (ArithWord w:{(Lit_Digits 1)})
                                  )
                                spids: [49 54]
                              )
                            }
                          spids: [48]
                        )
                      ]
                      spids: [48]
                    )
                  ]
                  spids: [38 57]
                )
            )
          ]
          spids: [20]
        )
      spids: [15 19]
    )
    (FuncDef
      name: scramble
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:i spids:[70]) op:Equal rhs:{(0)} spids:[70])]
              spids: [70]
            )
            (WhileUntil
              keyword: <KW_While while>
              cond: [(C {(read)} {(x)})]
              body: 
                (DoGroup
                  children: [
                    (If
                      arms: [
                        (if_arm
                          cond: [(C {(test)} {($ VSub_Name '$i')} {(-ne)} {(0)})]
                          action: [(C {(echo)} {(DQ ($ VSub_Name '$x'))})]
                          spids: [16777215 95]
                        )
                      ]
                      spids: [16777215 105]
                    )
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:i spids:[108])
                          op: Equal
                          rhs: 
                            {
                              (ArithSubPart
                                anode: 
                                  (ArithBinary
                                    op_id: Arith_Percent
                                    left: 
                                      (ArithBinary
                                        op_id: Arith_Plus
                                        left: (ArithWord w:{($ VSub_Name '$i')})
                                        right: (ArithWord w:{(Lit_Digits 1)})
                                      )
                                    right: (ArithWord w:{(Lit_Digits 10)})
                                  )
                                spids: [109 120]
                              )
                            }
                          spids: [108]
                        )
                      ]
                      spids: [108]
                    )
                  ]
                  spids: [81 123]
                )
              redirects: [
                (Redir
                  op: <Redir_Less '<'>
                  fd: 16777215
                  arg_word: {(DQ ($ VSub_Number '$1'))}
                )
                (Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {(DQ ($ VSub_Number '$1') (.new))}
                )
              ]
            )
            (C {(mv)} {(-f)} {(DQ ($ VSub_Number '$1') (.new))} {(DQ ($ VSub_Number '$1'))})
          ]
          spids: [67]
        )
      spids: [62 66]
    )
    (FuncDef
      name: run
      body: 
        (BraceGroup
          children: [
            (C {(echo)} {(EscapedLiteralPart token:<Lit_EscapedChar '\\$'>)} {(DQ ($ VSub_At '$@'))})
            (SimpleCommand
              words: [{(/usr/bin/time)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})]
            )
          ]
          spids: [158]
        )
      spids: [153 157]
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {(SQ <'\n'> <'\tgit commit --allow-empty -m initial &&\n'> <'\tgit tag root\n'>)}
    )
    (FuncDef
      name: do_tests
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:nlines spids:[203])
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [203]
                )
                (assign_pair
                  lhs: (LhsName name:pr spids:[206])
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Number 2>
                        suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{})
                        spids: [207 210]
                      )
                    }
                  spids: [206]
                )
              ]
              spids: [203]
            )
            (C {(test_expect_success)} {($ VSub_Name '$pr')} 
              {(DQ ('setup: ') ($ VSub_Name '$nlines') (' lines'))} 
              {
                (DQ ('\n') ('\t\trm -f .gitattributes &&\n') ('\t\tgit checkout -q -f master &&\n') 
                  ('\t\tgit reset --hard root &&\n') ('\t\tcount ') ($ VSub_Name '$nlines') (' >file &&\n') ('\t\tgit add file &&\n') 
                  ('\t\tgit commit -q -m initial &&\n') ('\t\tgit branch -f other &&\n') ('\n') ('\t\tscramble file &&\n') ('\t\tgit add file &&\n') 
                  ("\t\tgit commit -q -m 'change big file' &&\n") ('\n') ('\t\tgit checkout -q other &&\n') ('\t\t: >newfile &&\n') ('\t\tgit add newfile &&\n') 
                  ("\t\tgit commit -q -m 'add small file' &&\n") ('\n') ('\t\tgit cherry-pick master >/dev/null 2>&1\n') ('\t')
                )
              }
            )
            (C {(test_debug)} {(DQ ('\n') ('\t\trun git diff master^') (Lit_Other '\\') ('!\n') ('\t'))})
            (C {(test_expect_success)} {($ VSub_Name '$pr')} {(SQ <'setup attributes'>)} 
              {(DQ ('\n') ("\t\techo 'file binary' >.gitattributes\n") ('\t'))}
            )
            (C {(test_debug)} 
              {
                (DQ ('\n') ('\t\trun git format-patch --stdout master &&\n') 
                  ('\t\trun git format-patch --stdout --ignore-if-in-upstream master\n') ('\t')
                )
              }
            )
            (C {(test_expect_success)} {($ VSub_Name '$pr')} {(SQ <'detect upstream patch'>)} 
              {
                (SQ <'\n'> <'\t\tgit checkout -q master &&\n'> <'\t\tscramble file &&\n'> 
                  <'\t\tgit add file &&\n'> <'\t\tgit commit -q -m "change big file again" &&\n'> <'\t\tgit checkout -q other^{} &&\n'> 
                  <'\t\tgit rebase master &&\n'> <'\t\ttest_must_fail test -n "$(git rev-list master...HEAD~)"\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {($ VSub_Name '$pr')} {(SQ <'do not drop patch'>)} 
              {
                (SQ <'\n'> <'\t\tgit branch -f squashed master &&\n'> 
                  <'\t\tgit checkout -q -f squashed &&\n'> <'\t\tgit reset -q --soft HEAD~2 &&\n'> <'\t\tgit commit -q -m squashed &&\n'> 
                  <'\t\tgit checkout -q other^{} &&\n'> <'\t\ttest_must_fail git rebase squashed &&\n'> <'\t\trm -rf .git/rebase-apply\n'> <'\t'>
                )
              }
            )
          ]
          spids: [200]
        )
      spids: [195 199]
    )
    (C {(do_tests)} {(500)})
    (C {(do_tests)} {(50000)} {(EXPENSIVE)})
    (C {(test_done)})
  ]
)