(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Test commit notes index (expensive!)'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: create_repo
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:number_of_commits)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [32]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:nr)
                  op: assign_op.Equal
                  rhs: {<0>}
                  spids: [36]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<test>} {<-d>} {<.git>})
                (BraceGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DAmp Id.Op_DAmp]
                      children: [
                        (C {<git>} {<init>})
                        (command.Pipeline
                          children: [
                            (command.Subshell
                              child: 
                                (command.AndOr
                                  ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
                                  children: [
                                    (command.WhileUntil
                                      keyword: <Id.KW_While while>
                                      cond: [
                                        (C {<test>} {($ Id.VSub_DollarName '$nr')} {<-lt>} 
                                          {($ Id.VSub_DollarName '$number_of_commits')}
                                        )
                                      ]
                                      body: 
                                        (command.DoGroup
                                          children: [
                                            (command.ShAssignment
                                              pairs: [
                                                (assign_pair
                                                  lhs: (sh_lhs_expr.Name name:nr)
                                                  op: assign_op.Equal
                                                  rhs: 
                                                    {
                                                      (word_part.ArithSub
                                                        anode: 
                                                          (arith_expr.Binary
                                                            op_id: Id.Arith_Plus
                                                            left: {($ Id.VSub_DollarName '$nr')}
                                                            right: {<Id.Lit_Digits 1>}
                                                          )
                                                      )
                                                    }
                                                  spids: [75]
                                                )
                                              ]
                                            )
                                            (command.ShAssignment
                                              pairs: [
                                                (assign_pair
                                                  lhs: (sh_lhs_expr.Name name:mark)
                                                  op: assign_op.Equal
                                                  rhs: 
                                                    {
                                                      (word_part.ArithSub
                                                        anode: 
                                                          (arith_expr.Binary
                                                            op_id: Id.Arith_Plus
                                                            left: {($ Id.VSub_DollarName '$nr')}
                                                            right: {($ Id.VSub_DollarName '$nr')}
                                                          )
                                                      )
                                                    }
                                                  spids: [84]
                                                )
                                              ]
                                            )
                                            (command.ShAssignment
                                              pairs: [
                                                (assign_pair
                                                  lhs: (sh_lhs_expr.Name name:notemark)
                                                  op: assign_op.Equal
                                                  rhs: 
                                                    {
                                                      (word_part.ArithSub
                                                        anode: 
                                                          (arith_expr.Binary
                                                            op_id: Id.Arith_Plus
                                                            left: {($ Id.VSub_DollarName '$mark')}
                                                            right: {<Id.Lit_Digits 1>}
                                                          )
                                                      )
                                                    }
                                                  spids: [93]
                                                )
                                              ]
                                            )
                                            (command.AndOr
                                              ops: [Id.Op_DAmp Id.Op_DAmp]
                                              children: [
                                                (C {<test_tick>})
                                                (command.Simple
                                                  words: [{<cat>}]
                                                  redirects: [
                                                    (redir
                                                      op: <Id.Redir_DLessDash '<<-'>
                                                      loc: (redir_loc.Fd fd:0)
                                                      arg: 
                                                        (redir_param.MultiLine
                                                          here_begin: {<INPUT_END>}
                                                          here_end_span_id: 149
                                                          stdin_parts: [
                                                            <'commit refs/heads/master\n'>
                                                            <'mark :'>
                                                            ($ Id.VSub_DollarName '$mark')
                                                            <'\n'>
                                                            <'committer '>
                                                            ($ Id.VSub_DollarName 
'$GIT_COMMITTER_NAME'
                                                            )
                                                            <' <'>
                                                            ($ Id.VSub_DollarName 
'$GIT_COMMITTER_EMAIL'
                                                            )
                                                            <'> '>
                                                            ($ Id.VSub_DollarName 
'$GIT_COMMITTER_DATE'
                                                            )
                                                            <'\n'>
                                                            <'data <<COMMIT\n'>
                                                            <'commit #'>
                                                            ($ Id.VSub_DollarName '$nr')
                                                            <'\n'>
                                                            <'COMMIT\n'>
                                                            <'\n'>
                                                            <'M 644 inline file\n'>
                                                            <'data <<EOF\n'>
                                                            <'file in commit #'>
                                                            ($ Id.VSub_DollarName '$nr')
                                                            <'\n'>
                                                            <'EOF\n'>
                                                            <'\n'>
                                                            <'blob\n'>
                                                            <'mark :'>
                                                            ($ Id.VSub_DollarName '$notemark')
                                                            <'\n'>
                                                            <'data <<EOF\n'>
                                                            <'note for commit #'>
                                                            ($ Id.VSub_DollarName '$nr')
                                                            <'\n'>
                                                            <'EOF\n'>
                                                            <'\n'>
                                                          ]
                                                        )
                                                    )
                                                  ]
                                                  do_fork: T
                                                )
                                                (command.Simple
                                                  words: [
                                                    {<echo>}
                                                    {
                                                      (DQ <'N :'> ($ Id.VSub_DollarName '$notemark') 
                                                        <' :'> ($ Id.VSub_DollarName '$mark')
                                                      )
                                                    }
                                                  ]
                                                  redirects: [
                                                    (redir
                                                      op: <Id.Redir_DGreat '>>'>
                                                      loc: (redir_loc.Fd fd:1)
                                                      arg: {<note_commit>}
                                                    )
                                                  ]
                                                  do_fork: T
                                                )
                                              ]
                                            )
                                          ]
                                        )
                                    )
                                    (C {<test_tick>})
                                    (command.Simple
                                      words: [{<cat>}]
                                      redirects: [
                                        (redir
                                          op: <Id.Redir_DLessDash '<<-'>
                                          loc: (redir_loc.Fd fd:0)
                                          arg: 
                                            (redir_param.MultiLine
                                              here_begin: {<INPUT_END>}
                                              here_end_span_id: 194
                                              stdin_parts: [
                                                <'commit refs/notes/commits\n'>
                                                <'committer '>
                                                ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
                                                <' <'>
                                                ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
                                                <'> '>
                                                ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
                                                <'\n'>
                                                <'data <<COMMIT\n'>
                                                <'notes\n'>
                                                <'COMMIT\n'>
                                                <'\n'>
                                              ]
                                            )
                                        )
                                      ]
                                      do_fork: T
                                    )
                                    (C {<cat>} {<note_commit>})
                                  ]
                                )
                            )
                            (C {<git>} {<fast-import>} {<--quiet>})
                          ]
                          negated: F
                        )
                        (C {<git>} {<config>} {<core.notesRef>} {<'refs/notes/commits'>})
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_notes
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:count)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number '$1')}
                      spids: [238]
                    )
                  ]
                )
                (C {<git>} {<config>} {<core.notesRef>} {<'refs/notes/commits'>})
                (command.Pipeline
                  children: [
                    (C {<git>} {<log>})
                    (command.Simple
                      words: [{<grep>} {(DQ <'^    '>)}]
                      redirects: [
                        (redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<output>}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  negated: F
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:i)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_DollarName '$count')}
                      spids: [273]
                    )
                  ]
                )
                (command.WhileUntil
                  keyword: <Id.KW_While while>
                  cond: [(C {<test>} {($ Id.VSub_DollarName '$i')} {<-gt>} {<0>})]
                  body: 
                    (command.DoGroup
                      children: [
                        (command.AndOr
                          ops: [Id.Op_DAmp Id.Op_DAmp]
                          children: [
                            (C {<echo>} {(DQ <'    commit #'> ($ Id.VSub_DollarName '$i'))})
                            (C {<echo>} {(DQ <'    note for commit #'> ($ Id.VSub_DollarName '$i'))})
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:i)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (word_part.ArithSub
                                        anode: 
                                          (arith_expr.Binary
                                            op_id: Id.Arith_Minus
                                            left: {($ Id.VSub_DollarName '$i')}
                                            right: {<Id.Lit_Digits 1>}
                                          )
                                      )
                                    }
                                  spids: [313]
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})]
                )
                (C {<test_cmp>} {<expect>} {<output>})
              ]
            )
          ]
        )
    )
    (command.Simple
      words: [{<write_script>} {<time_notes>}]
      redirects: [
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 363
              stdin_parts: [
                <'\tmode=$1\n'>
                <'\ti=1\n'>
                <'\twhile test $i -lt $2\n'>
                <'\tdo\n'>
                <'\t\tcase $1 in\n'>
                <'\t\tno-notes)\n'>
                <'\t\t\tGIT_NOTES_REF=non-existing\n'>
                <'\t\t\texport GIT_NOTES_REF\n'>
                <'\t\t\t;;\n'>
                <'\t\tnotes)\n'>
                <'\t\t\tunset GIT_NOTES_REF\n'>
                <'\t\t\t;;\n'>
                <'\t\tesac\n'>
                <'\t\tgit log\n'>
                <'\t\ti=$(($i+1))\n'>
                <'\tdone >/dev/null\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.ShFunction
      name: time_notes
      body: 
        (BraceGroup
          children: [
            (command.ForEach
              iter_name: mode
              iter_words: [{<no-notes>} {<notes>}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (C {<echo>} {($ Id.VSub_DollarName '$mode')})
                    (C {<'/usr/bin/time'>} {<'../time_notes'>} {($ Id.VSub_DollarName '$mode')} 
                      {($ Id.VSub_Number '$1')}
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: do_tests
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:count)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [414]
                )
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:pr)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Number 2>
                        suffix_op: (suffix_op.Unary op_id:Id.VTest_Hyphen arg_word:{})
                      )
                    }
                  spids: [417]
                )
              ]
            )
            (C {<test_expect_success>} {($ Id.VSub_DollarName '$pr')} 
              {(DQ <'setup '> ($ Id.VSub_DollarName '$count'))} 
              {
                (SQ <'\n'> <'\t\tmkdir "$count" &&\n'> <'\t\t(\n'> <'\t\t\tcd "$count" &&\n'> 
                  <'\t\t\tcreate_repo "$count"\n'> <'\t\t)\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} {($ Id.VSub_DollarName '$pr')} {(SQ <'notes work'>)} 
              {
                (SQ <'\n'> <'\t\t(\n'> <'\t\t\tcd "$count" &&\n'> <'\t\t\ttest_notes "$count"\n'> 
                  <'\t\t)\n'> <'\t'>
                )
              }
            )
            (C {<test_expect_success>} 
              {
                (DQ <USR_BIN_TIME> 
                  (braced_var_sub
                    token: <Id.VSub_Name pr>
                    suffix_op: 
                      (suffix_op.Unary
                        op_id: Id.VTest_ColonPlus
                        arg_word: {<','> ($ Id.VSub_DollarName '$pr')}
                      )
                  )
                )
              } {(SQ <'notes timing with /usr/bin/time'>)} 
              {
                (SQ <'\n'> <'\t\t(\n'> <'\t\t\tcd "$count" &&\n'> <'\t\t\ttime_notes 100\n'> <'\t\t)\n'> 
                  <'\t'>
                )
              }
            )
          ]
        )
    )
    (C {<do_tests>} {<10>})
    (command.ForEach
      iter_name: count
      iter_words: [{<100>} {<1000>} {<10000>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [(C {<do_tests>} {(DQ ($ Id.VSub_DollarName '$count'))} {<EXPENSIVE>})]
        )
    )
    (C {<test_done>})
  ]
)