(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:'test git fast-import of notes objects' span_id:15))}
          spids: [13]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:28) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:31)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 118
          stdin_parts: [
            ('commit refs/heads/master\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('first commit\n')
            ('COMMIT\n')
            ('\n')
            ('M 644 inline foo\n')
            ('data <<EOF\n')
            ('file foo in first commit\n')
            ('EOF\n')
            ('\n')
            ('M 755 inline bar\n')
            ('data <<EOF\n')
            ('file bar in first commit\n')
            ('EOF\n')
            ('\n')
            ('M 644 inline baz/xyzzy\n')
            ('data <<EOF\n')
            ('file baz/xyzzy in first commit\n')
            ('EOF\n')
            ('\n')
            ('commit refs/heads/master\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('second commit\n')
            ('COMMIT\n')
            ('\n')
            ('M 644 inline foo\n')
            ('data <<EOF\n')
            ('file foo in second commit\n')
            ('EOF\n')
            ('\n')
            ('M 755 inline baz/xyzzy\n')
            ('data <<EOF\n')
            ('file baz/xyzzy in second commit\n')
            ('EOF\n')
            ('\n')
            ('commit refs/heads/master\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('third commit\n')
            ('COMMIT\n')
            ('\n')
            ('M 644 inline foo\n')
            ('data <<EOF\n')
            ('file foo in third commit\n')
            ('EOF\n')
            ('\n')
            ('commit refs/heads/master\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('fourth commit\n')
            ('COMMIT\n')
            ('\n')
            ('M 755 inline bar\n')
            ('data <<EOF\n')
            ('file bar in fourth commit\n')
            ('EOF\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'set up master branch' span_id:123))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:127) (Token id:Id.Lit_Chars val:'\n' span_id:128) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:129) (Token id:Id.Lit_Chars val:'\tgit whatchanged master\n' span_id:130)
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit4)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:135)
                command_list: 
                  (command.CommandList
                    children: [(C {(git)} {(rev-parse)} {(refs/heads/master)})]
                  )
              )
            }
          spids: [134]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit3)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:144)
                command_list: 
                  (command.CommandList
                    children: [(C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_DollarName '$commit4') ('^'))})]
                  )
              )
            }
          spids: [143]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit2)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:156)
                command_list: 
                  (command.CommandList
                    children: [(C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_DollarName '$commit4') ('~2'))})]
                  )
              )
            }
          spids: [155]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit1)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:168)
                command_list: 
                  (command.CommandList
                    children: [(C {(git)} {(rev-parse)} {(DQ ($ Id.VSub_DollarName '$commit4') ('~3'))})]
                  )
              )
            }
          spids: [167]
        )
      ]
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:184) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:187)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 217
          stdin_parts: [
            ('commit refs/notes/test\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('first notes commit\n')
            ('COMMIT\n')
            ('\n')
            ('M 644 inline ')
            ($ Id.VSub_DollarName '$commit1')
            ('\n')
            ('data <<EOF\n')
            ('first note for first commit\n')
            ('EOF\n')
            ('\n')
            ('M 755 inline ')
            ($ Id.VSub_DollarName '$commit2')
            ('\n')
            ('data <<EOF\n')
            ('first note for second commit\n')
            ('EOF\n')
            ('\n')
          ]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:221)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:224)
          fd: -1
          here_begin: {(EXPECT_END)}
          here_end_span_id: 234
          stdin_parts: [
            ('    fourth commit\n')
            ('    third commit\n')
            ('    second commit\n')
            ('    first note for second commit\n')
            ('    first commit\n')
            ('    first note for first commit\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'add notes with simple M command' span_id:239))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:243) (Token id:Id.Lit_Chars val:'\n' span_id:244) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:245) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&\n'
            span_id: 246
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:247) 
          (Token id:Id.Lit_Chars val:'\n' span_id:248)
        )
      }
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:256) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:259)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 291
          stdin_parts: [
            ('feature notes\n')
            ('commit refs/notes/test\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('second notes commit\n')
            ('COMMIT\n')
            ('\n')
            ('from refs/notes/test^0\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit3')
            ('\n')
            ('data <<EOF\n')
            ('first note for third commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit4')
            ('\n')
            ('data <<EOF\n')
            ('first note for fourth commit\n')
            ('EOF\n')
            ('\n')
          ]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:295)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:298)
          fd: -1
          here_begin: {(EXPECT_END)}
          here_end_span_id: 310
          stdin_parts: [
            ('    fourth commit\n')
            ('    first note for fourth commit\n')
            ('    third commit\n')
            ('    first note for third commit\n')
            ('    second commit\n')
            ('    first note for second commit\n')
            ('    first commit\n')
            ('    first note for first commit\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'add notes with simple N command' span_id:315))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:319) (Token id:Id.Lit_Chars val:'\n' span_id:320) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:321) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&\n'
            span_id: 322
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:323) 
          (Token id:Id.Lit_Chars val:'\n' span_id:324)
        )
      }
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:332) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:335)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 380
          stdin_parts: [
            ('commit refs/notes/test\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('third notes commit\n')
            ('COMMIT\n')
            ('\n')
            ('from refs/notes/test^0\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit1')
            ('\n')
            ('data <<EOF\n')
            ('second note for first commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit2')
            ('\n')
            ('data <<EOF\n')
            ('second note for second commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit3')
            ('\n')
            ('data <<EOF\n')
            ('second note for third commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit4')
            ('\n')
            ('data <<EOF\n')
            ('second note for fourth commit\n')
            ('EOF\n')
            ('\n')
          ]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:384)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:387)
          fd: -1
          here_begin: {(EXPECT_END)}
          here_end_span_id: 399
          stdin_parts: [
            ('    fourth commit\n')
            ('    second note for fourth commit\n')
            ('    third commit\n')
            ('    second note for third commit\n')
            ('    second commit\n')
            ('    second note for second commit\n')
            ('    first commit\n')
            ('    second note for first commit\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'update existing notes with N command' span_id:404))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:408) (Token id:Id.Lit_Chars val:'\n' span_id:409) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:410) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&\n'
            span_id: 411
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:412) 
          (Token id:Id.Lit_Chars val:'\n' span_id:413)
        )
      }
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:421) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:424)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 545
          stdin_parts: [
            ('commit refs/notes/test\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('fourth notes commit\n')
            ('COMMIT\n')
            ('\n')
            ('from refs/notes/test^0\n')
            ('M 644 inline ')
            (command_sub
              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:441)
              command_list: 
                (command.CommandList
                  children: [
                    (command.Pipeline
                      children: [
                        (C {(echo)} {(DQ ($ Id.VSub_DollarName '$commit3'))})
                        (C {(sed)} {(DQ ('s|^..|&/|'))})
                      ]
                      negated: F
                    )
                  ]
                )
            )
            ('\n')
            ('data <<EOF\n')
            ('prefix of note for third commit\n')
            ('EOF\n')
            ('\n')
            ('M 644 inline ')
            (command_sub
              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:462)
              command_list: 
                (command.CommandList
                  children: [
                    (command.Pipeline
                      children: [
                        (C {(echo)} {(DQ ($ Id.VSub_DollarName '$commit4'))})
                        (C {(sed)} {(DQ ('s|^..|&/|'))})
                      ]
                      negated: F
                    )
                  ]
                )
            )
            ('\n')
            ('data <<EOF\n')
            ('prefix of note for fourth commit\n')
            ('EOF\n')
            ('\n')
            ('M 644 inline ')
            (command_sub
              left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:483)
              command_list: 
                (command.CommandList
                  children: [
                    (command.Pipeline
                      children: [
                        (C {(echo)} {(DQ ($ Id.VSub_DollarName '$commit4'))})
                        (C {(sed)} 
                          {
                            (DQ ('s|^') (Id.Lit_Other '\\') ('(..') (Id.Lit_Other '\\') (')') 
                              (Id.Lit_Other '\\') ('(..') (Id.Lit_Other '\\') (')|') (Id.Lit_Other '\\') (1/) (Id.Lit_Other '\\') ('2/|')
                            )
                          }
                        )
                      ]
                      negated: F
                    )
                  ]
                )
            )
            ('\n')
            ('data <<EOF\n')
            ('pre-prefix of note for fourth commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit1')
            ('\n')
            ('data <<EOF\n')
            ('third note for first commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit2')
            ('\n')
            ('data <<EOF\n')
            ('third note for second commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit3')
            ('\n')
            ('data <<EOF\n')
            ('third note for third commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit4')
            ('\n')
            ('data <<EOF\n')
            ('third note for fourth commit\n')
            ('EOF\n')
            ('\n')
            ('\n')
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:whitespace)
          op: assign_op.Equal
          rhs: {(DQ ('    '))}
          spids: [547]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:555)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:558)
          fd: -1
          here_begin: {(EXPECT_END)}
          here_end_span_id: 579
          stdin_parts: [
            ('    fourth commit\n')
            ('    pre-prefix of note for fourth commit\n')
            ($ Id.VSub_DollarName '$whitespace')
            ('\n')
            ('    prefix of note for fourth commit\n')
            ($ Id.VSub_DollarName '$whitespace')
            ('\n')
            ('    third note for fourth commit\n')
            ('    third commit\n')
            ('    prefix of note for third commit\n')
            ($ Id.VSub_DollarName '$whitespace')
            ('\n')
            ('    third note for third commit\n')
            ('    second commit\n')
            ('    third note for second commit\n')
            ('    first commit\n')
            ('    third note for first commit\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'add concatentation notes with M command' span_id:584))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:588) (Token id:Id.Lit_Chars val:'\n' span_id:589) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:590) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&\n'
            span_id: 591
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:592) 
          (Token id:Id.Lit_Chars val:'\n' span_id:593)
        )
      }
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:601) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:604)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 623
          stdin_parts: [
            ('commit refs/notes/test\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('fifth notes commit\n')
            ('COMMIT\n')
            ('\n')
            ('from refs/notes/test^0\n')
            ('deleteall\n')
            ('\n')
          ]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:627)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:630)
          fd: -1
          here_begin: {(EXPECT_END)}
          here_end_span_id: 638
          stdin_parts: [
            ('    fourth commit\n')
            ('    third commit\n')
            ('    second commit\n')
            ('    first commit\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'verify that deleteall also removes notes' span_id:643))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:647) (Token id:Id.Lit_Chars val:'\n' span_id:648) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:649) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&\n'
            span_id: 650
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:651) 
          (Token id:Id.Lit_Chars val:'\n' span_id:652)
        )
      }
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:(Token id:Id.Redir_Great val:'>' span_id:660) fd:-1 arg_word:{(input)})
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:663)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 708
          stdin_parts: [
            ('commit refs/notes/test\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('sixth notes commit\n')
            ('COMMIT\n')
            ('\n')
            ('from refs/notes/test^0\n')
            ('M 644 inline ')
            ($ Id.VSub_DollarName '$commit1')
            ('\n')
            ('data <<EOF\n')
            ('third note for first commit\n')
            ('EOF\n')
            ('\n')
            ('M 644 inline ')
            ($ Id.VSub_DollarName '$commit3')
            ('\n')
            ('data <<EOF\n')
            ('third note for third commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit1')
            ('\n')
            ('data <<EOF\n')
            ('fourth note for first commit\n')
            ('EOF\n')
            ('\n')
            ('N inline ')
            ($ Id.VSub_DollarName '$commit3')
            ('\n')
            ('data <<EOF\n')
            ('fourth note for third commit\n')
            ('EOF\n')
            ('\n')
          ]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:712)
          fd: -1
          arg_word: {(expect)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:715)
          fd: -1
          here_begin: {(EXPECT_END)}
          here_end_span_id: 725
          stdin_parts: [
            ('    fourth commit\n')
            ('    third commit\n')
            ('    fourth note for third commit\n')
            ('    second commit\n')
            ('    first commit\n')
            ('    fourth note for first commit\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify that later N commands override earlier M commands'
            span_id: 730
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:734) (Token id:Id.Lit_Chars val:'\n' span_id:735) 
          (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:736) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/test git log | grep "^    " > actual &&\n'
            span_id: 737
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:738) 
          (Token id:Id.Lit_Chars val:'\n' span_id:739)
        )
      }
    )
    (command.ShFunction
      name: fast_import_commits
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_ref)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [754]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_num_commits)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [758]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_append_to_file)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$3')}
                  spids: [762]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_i)
                  op: assign_op.Equal
                  rhs: {(0)}
                  spids: [766]
                )
              ]
            )
            (command.WhileUntil
              keyword: (Token id:Id.KW_While val:while span_id:770)
              cond: [
                (C {(test)} {($ Id.VSub_DollarName '$my_i')} {(-lt)} 
                  {($ Id.VSub_DollarName '$my_num_commits')}
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:my_i)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (word_part.ArithSub
                                anode: 
                                  (arith_expr.Binary
                                    op_id: Id.Arith_Plus
                                    left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$my_i')})
                                    right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                  )
                              )
                            }
                          spids: [784]
                        )
                      ]
                    )
                    (C {(test_tick)})
                    (command.Simple
                      words: [{(cat)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_DGreat val:'>>' span_id:800)
                          fd: -1
                          arg_word: {(DQ ($ Id.VSub_DollarName '$my_append_to_file'))}
                        )
                        (redir.HereDoc
                          op: (Token id:Id.Redir_DLess val:'<<' span_id:805)
                          fd: -1
                          here_begin: {(INPUT_END)}
                          here_end_span_id: 835
                          stdin_parts: [
                            ('commit ')
                            ($ Id.VSub_DollarName '$my_ref')
                            ('\n')
                            ('mark :')
                            ($ Id.VSub_DollarName '$my_i')
                            ('\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 '$my_i')
                            ('\n')
                            ('COMMIT\n')
                            ('\n')
                            ('M 644 inline file\n')
                            ('data <<EOF\n')
                            ('file contents in commit #')
                            ($ Id.VSub_DollarName '$my_i')
                            ('\n')
                            ('EOF\n')
                            ('\n')
                          ]
                        )
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: fast_import_notes
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_notes_ref)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [856]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_num_commits)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [860]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_append_to_file)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$3')}
                  spids: [864]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_note_append)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$4')}
                  spids: [868]
                )
              ]
            )
            (C {(test_tick)})
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:877)
                  fd: -1
                  arg_word: {(DQ ($ Id.VSub_DollarName '$my_append_to_file'))}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:882)
                  fd: -1
                  here_begin: {(INPUT_END)}
                  here_end_span_id: 902
                  stdin_parts: [
                    ('commit ')
                    ($ Id.VSub_DollarName '$my_notes_ref')
                    ('\n')
                    ('committer ')
                    ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
                    (' <')
                    ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
                    ('> ')
                    ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
                    ('\n')
                    ('data <<COMMIT\n')
                    ('committing ')
                    ($ Id.VSub_DollarName '$my_num_commits')
                    (' notes\n')
                    ('COMMIT\n')
                    ('\n')
                  ]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:my_i)
                  op: assign_op.Equal
                  rhs: {(0)}
                  spids: [905]
                )
              ]
            )
            (command.WhileUntil
              keyword: (Token id:Id.KW_While val:while span_id:909)
              cond: [
                (C {(test)} {($ Id.VSub_DollarName '$my_i')} {(-lt)} 
                  {($ Id.VSub_DollarName '$my_num_commits')}
                )
              ]
              body: 
                (command.DoGroup
                  children: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:my_i)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (word_part.ArithSub
                                anode: 
                                  (arith_expr.Binary
                                    op_id: Id.Arith_Plus
                                    left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$my_i')})
                                    right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                  )
                              )
                            }
                          spids: [923]
                        )
                      ]
                    )
                    (command.Simple
                      words: [{(cat)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_DGreat val:'>>' span_id:936)
                          fd: -1
                          arg_word: {(DQ ($ Id.VSub_DollarName '$my_append_to_file'))}
                        )
                        (redir.HereDoc
                          op: (Token id:Id.Redir_DLess val:'<<' span_id:941)
                          fd: -1
                          here_begin: {(INPUT_END)}
                          here_end_span_id: 955
                          stdin_parts: [
                            ('N inline :')
                            ($ Id.VSub_DollarName '$my_i')
                            ('\n')
                            ('data <<EOF\n')
                            ('note for commit #')
                            ($ Id.VSub_DollarName '$my_i')
                            ($ Id.VSub_DollarName '$my_note_append')
                            ('\n')
                            ('EOF\n')
                            ('\n')
                          ]
                        )
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (C {(rm)} {(input)} {(expect)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:num_commits)
          op: assign_op.Equal
          rhs: {(400)}
          spids: [969]
        )
      ]
    )
    (C {(fast_import_commits)} {(DQ (refs/heads/many_commits))} {($ Id.VSub_DollarName '$num_commits')} 
      {(input)}
    )
    (C {(fast_import_notes)} {(DQ (refs/notes/many_notes))} {($ Id.VSub_DollarName '$num_commits')} 
      {(input)}
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_DGreat val:'>>' span_id:1005)
          fd: -1
          arg_word: {(input)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:1008)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 1039
          stdin_parts: [
            ('commit refs/notes/many_notes\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('committing some non-notes to the notes tree\n')
            ('COMMIT\n')
            ('\n')
            ('M 755 inline foobar/non-note.txt\n')
            ('data <<EOF\n')
            ('This is not a note, but rather a regular file residing in a notes tree\n')
            ('EOF\n')
            ('\n')
            ('M 644 inline deadbeef\n')
            ('data <<EOF\n')
            ('Non-note file\n')
            ('EOF\n')
            ('\n')
            ('M 644 inline de/adbeef\n')
            ('data <<EOF\n')
            ('Another non-note file\n')
            ('EOF\n')
            ('\n')
          ]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:i)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$num_commits')}
          spids: [1043]
        )
      ]
    )
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:1046)
      cond: [(C {(test)} {($ Id.VSub_DollarName '$i')} {(-gt)} {(0)})]
      body: 
        (command.DoGroup
          children: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:1061)
                  fd: -1
                  arg_word: {(expect)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:1064)
                  fd: -1
                  here_begin: {(EXPECT_END)}
                  here_end_span_id: 1074
                  stdin_parts: [
                    ('    commit #')
                    ($ Id.VSub_DollarName '$i')
                    ('\n')
                    ('    note for commit #')
                    ($ Id.VSub_DollarName '$i')
                    ('\n')
                  ]
                )
              ]
            )
            (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1076]
                )
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'add lots of commits and notes' span_id:1092))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1096) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1097) (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:1098) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/many_notes git log refs/heads/many_commits |\n'
            span_id: 1099
          ) (Token id:Id.Lit_Chars val:'\t    grep "^    " > actual &&\n' span_id:1100) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:1101) (Token id:Id.Lit_Chars val:'\n' span_id:1102)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify that lots of notes trigger a fanout scheme'
            span_id: 1109
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1113) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1114) 
          (Token
            id: Id.Lit_Chars
            val: '\t# None of the entries in the top-level notes tree should be a full SHA1\n'
            span_id: 1115
          ) (Token id:Id.Lit_Chars val:'\tgit ls-tree --name-only refs/notes/many_notes |\n' span_id:1116) 
          (Token id:Id.Lit_Chars val:'\twhile read path\n' span_id:1117) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:1118) 
          (Token
            id: Id.Lit_Chars
            val: '\t\tif test $(expr length "$path") -ge 40\n'
            span_id: 1119
          ) (Token id:Id.Lit_Chars val:'\t\tthen\n' span_id:1120) 
          (Token id:Id.Lit_Chars val:'\t\t\treturn 1\n' span_id:1121) (Token id:Id.Lit_Chars val:'\t\tfi\n' span_id:1122) 
          (Token id:Id.Lit_Chars val:'\tdone\n' span_id:1123) (Token id:Id.Lit_Chars val:'\n' span_id:1124)
        )
      }
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_DGreat val:'>>' span_id:1130)
          fd: -1
          arg_word: {(expect_non-note1)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:1133)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 1139
          stdin_parts: [('This is not a note, but rather a regular file residing in a notes tree\n')]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_DGreat val:'>>' span_id:1143)
          fd: -1
          arg_word: {(expect_non-note2)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:1146)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 1152
          stdin_parts: [('Non-note file\n')]
        )
      ]
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_DGreat val:'>>' span_id:1156)
          fd: -1
          arg_word: {(expect_non-note3)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:1159)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 1165
          stdin_parts: [('Another non-note file\n')]
        )
      ]
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify that non-notes are untouched by a fanout change'
            span_id: 1170
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1174) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1175) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit cat-file -p refs/notes/many_notes:foobar/non-note.txt > actual &&\n'
            span_id: 1176
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect_non-note1 actual &&\n' span_id:1177) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit cat-file -p refs/notes/many_notes:deadbeef > actual &&\n'
            span_id: 1178
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect_non-note2 actual &&\n' span_id:1179) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit cat-file -p refs/notes/many_notes:de/adbeef > actual &&\n'
            span_id: 1180
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect_non-note3 actual\n' span_id:1181) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1182)
        )
      }
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:1193)
          fd: -1
          arg_word: {(input)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:1196)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 1212
          stdin_parts: [
            ('commit refs/notes/many_notes\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('changing notes for the top three commits\n')
            ('COMMIT\n')
            ('from refs/notes/many_notes^0\n')
          ]
        )
      ]
    )
    (C {(rm)} {(expect)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:i)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$num_commits')}
          spids: [1218]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:j) op:assign_op.Equal rhs:{(0)} spids:[1221])]
    )
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:1224)
      cond: [(C {(test)} {($ Id.VSub_DollarName '$j')} {(-lt)} {(3)})]
      body: 
        (command.DoGroup
          children: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:1239)
                  fd: -1
                  arg_word: {(input)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:1242)
                  fd: -1
                  here_begin: {(INPUT_END)}
                  here_end_span_id: 1254
                  stdin_parts: [
                    ('N inline refs/heads/many_commits~')
                    ($ Id.VSub_DollarName '$j')
                    ('\n')
                    ('data <<EOF\n')
                    ('changed note for commit #')
                    ($ Id.VSub_DollarName '$i')
                    ('\n')
                    ('EOF\n')
                  ]
                )
              ]
            )
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:1258)
                  fd: -1
                  arg_word: {(expect)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:1261)
                  fd: -1
                  here_begin: {(EXPECT_END)}
                  here_end_span_id: 1271
                  stdin_parts: [
                    ('    commit #')
                    ($ Id.VSub_DollarName '$i')
                    ('\n')
                    ('    changed note for commit #')
                    ($ Id.VSub_DollarName '$i')
                    ('\n')
                  ]
                )
              ]
            )
            (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1273]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:j)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$j')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1284]
                )
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'change a few existing notes' span_id:1300))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1304) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1305) (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:1306) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/many_notes git log -n3 refs/heads/many_commits |\n'
            span_id: 1307
          ) (Token id:Id.Lit_Chars val:'\t    grep "^    " > actual &&\n' span_id:1308) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:1309) (Token id:Id.Lit_Chars val:'\n' span_id:1310)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify that changing notes respect existing fanout'
            span_id: 1317
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1321) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1322) 
          (Token
            id: Id.Lit_Chars
            val: '\t# None of the entries in the top-level notes tree should be a full SHA1\n'
            span_id: 1323
          ) (Token id:Id.Lit_Chars val:'\tgit ls-tree --name-only refs/notes/many_notes |\n' span_id:1324) 
          (Token id:Id.Lit_Chars val:'\twhile read path\n' span_id:1325) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:1326) 
          (Token
            id: Id.Lit_Chars
            val: '\t\tif test $(expr length "$path") -ge 40\n'
            span_id: 1327
          ) (Token id:Id.Lit_Chars val:'\t\tthen\n' span_id:1328) 
          (Token id:Id.Lit_Chars val:'\t\t\treturn 1\n' span_id:1329) (Token id:Id.Lit_Chars val:'\t\tfi\n' span_id:1330) 
          (Token id:Id.Lit_Chars val:'\tdone\n' span_id:1331) (Token id:Id.Lit_Chars val:'\n' span_id:1332)
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:remaining_notes)
          op: assign_op.Equal
          rhs: {(10)}
          spids: [1336]
        )
      ]
    )
    (C {(test_tick)})
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:1343)
          fd: -1
          arg_word: {(input)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:1346)
          fd: -1
          here_begin: {(INPUT_END)}
          here_end_span_id: 1364
          stdin_parts: [
            ('commit refs/notes/many_notes\n')
            ('committer ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_NAME')
            (' <')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_EMAIL')
            ('> ')
            ($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')
            ('\n')
            ('data <<COMMIT\n')
            ('removing all notes but ')
            ($ Id.VSub_DollarName '$remaining_notes')
            ('\n')
            ('COMMIT\n')
            ('from refs/notes/many_notes^0\n')
          ]
        )
      ]
    )
    (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$num_commits')})
                    right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$remaining_notes')})
                  )
              )
            }
          spids: [1366]
        )
      ]
    )
    (command.ForEach
      iter_name: sha1
      iter_words: [
        {
          (command_sub
            left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1382)
            command_list: 
              (command.CommandList
                children: [
                  (C {(git)} {(rev-list)} {(-n)} {($ Id.VSub_DollarName '$i')} {(refs/heads/many_commits)})
                ]
              )
          )
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:1399)
                  fd: -1
                  arg_word: {(input)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:1402)
                  fd: -1
                  here_begin: {(INPUT_END)}
                  here_end_span_id: 1409
                  stdin_parts: [
                    ('N 0000000000000000000000000000000000000000 ')
                    ($ Id.VSub_DollarName '$sha1')
                    ('\n')
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:i)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$num_commits')}
          spids: [1413]
        )
      ]
    )
    (C {(rm)} {(expect)})
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:1420)
      cond: [(C {(test)} {($ Id.VSub_DollarName '$i')} {(-gt)} {(0)})]
      body: 
        (command.DoGroup
          children: [
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:1435)
                  fd: -1
                  arg_word: {(expect)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:1438)
                  fd: -1
                  here_begin: {(EXPECT_END)}
                  here_end_span_id: 1445
                  stdin_parts: [('    commit #') ($ Id.VSub_DollarName '$i') ('\n')]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(test)} {($ Id.VSub_DollarName '$i')} {(-le)} 
                      {($ Id.VSub_DollarName '$remaining_notes')}
                    )
                  ]
                  action: [
                    (command.Simple
                      words: [{(cat)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_DGreat val:'>>' span_id:1463)
                          fd: -1
                          arg_word: {(expect)}
                        )
                        (redir.HereDoc
                          op: (Token id:Id.Redir_DLess val:'<<' span_id:1466)
                          fd: -1
                          here_begin: {(EXPECT_END)}
                          here_end_span_id: 1473
                          stdin_parts: [('    note for commit #') ($ Id.VSub_DollarName '$i') ('\n')]
                        )
                      ]
                    )
                  ]
                  spids: [1447 1458]
                )
              ]
            )
            (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1478]
                )
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'remove lots of notes' span_id:1494))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1498) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1499) (Token id:Id.Lit_Chars val:'\tgit fast-import <input &&\n' span_id:1500) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/many_notes git log refs/heads/many_commits |\n'
            span_id: 1501
          ) (Token id:Id.Lit_Chars val:'\t    grep "^    " > actual &&\n' span_id:1502) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:1503) (Token id:Id.Lit_Chars val:'\n' span_id:1504)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify that removing notes trigger fanout consolidation'
            span_id: 1511
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1515) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1516) 
          (Token
            id: Id.Lit_Chars
            val: '\t# All entries in the top-level notes tree should be a full SHA1\n'
            span_id: 1517
          ) (Token id:Id.Lit_Chars val:'\tgit ls-tree --name-only -r refs/notes/many_notes |\n' span_id:1518) 
          (Token id:Id.Lit_Chars val:'\twhile read path\n' span_id:1519) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:1520) 
          (Token
            id: Id.Lit_Chars
            val: '\t\t# Explicitly ignore the non-note paths\n'
            span_id: 1521
          ) (Token id:Id.Lit_Chars val:'\t\ttest "$path" = "foobar/non-note.txt" && continue\n' span_id:1522) 
          (Token
            id: Id.Lit_Chars
            val: '\t\ttest "$path" = "deadbeef" && continue\n'
            span_id: 1523
          ) (Token id:Id.Lit_Chars val:'\t\ttest "$path" = "de/adbeef" && continue\n' span_id:1524) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1525) (Token id:Id.Lit_Chars val:'\t\tif test $(expr length "$path") -ne 40\n' span_id:1526) 
          (Token id:Id.Lit_Chars val:'\t\tthen\n' span_id:1527) (Token id:Id.Lit_Chars val:'\t\t\treturn 1\n' span_id:1528) 
          (Token id:Id.Lit_Chars val:'\t\tfi\n' span_id:1529) (Token id:Id.Lit_Chars val:'\tdone\n' span_id:1530) (Token id:Id.Lit_Chars val:'\n' span_id:1531)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify that non-notes are untouched by a fanout change'
            span_id: 1538
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1542) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1543) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit cat-file -p refs/notes/many_notes:foobar/non-note.txt > actual &&\n'
            span_id: 1544
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect_non-note1 actual &&\n' span_id:1545) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit cat-file -p refs/notes/many_notes:deadbeef > actual &&\n'
            span_id: 1546
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect_non-note2 actual &&\n' span_id:1547) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit cat-file -p refs/notes/many_notes:de/adbeef > actual &&\n'
            span_id: 1548
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect_non-note3 actual\n' span_id:1549) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1550)
        )
      }
    )
    (C {(rm)} {(input)} {(expect)})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:num_notes_refs)
          op: assign_op.Equal
          rhs: {(10)}
          spids: [1561]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:num_commits)
          op: assign_op.Equal
          rhs: {(16)}
          spids: [1564]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:some_commits)
          op: assign_op.Equal
          rhs: {(8)}
          spids: [1567]
        )
      ]
    )
    (C {(fast_import_commits)} {(DQ (refs/heads/more_commits))} {($ Id.VSub_DollarName '$num_commits')} 
      {(input)}
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:i) op:assign_op.Equal rhs:{(0)} spids:[1586])]
    )
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:1589)
      cond: [
        (C {(test)} {($ Id.VSub_DollarName '$i')} {(-lt)} {($ Id.VSub_DollarName '$num_notes_refs')})
      ]
      body: 
        (command.DoGroup
          children: [
            (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_Plus
                            left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1602]
                )
              ]
            )
            (C {(fast_import_notes)} {(DQ (refs/notes/more_notes_) ($ Id.VSub_DollarName '$i'))} 
              {($ Id.VSub_DollarName '$num_commits')} {(input)}
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:i) op:assign_op.Equal rhs:{(0)} spids:[1629])]
    )
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:1632)
      cond: [
        (C {(test)} {($ Id.VSub_DollarName '$i')} {(-lt)} {($ Id.VSub_DollarName '$num_notes_refs')})
      ]
      body: 
        (command.DoGroup
          children: [
            (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_Plus
                            left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1645]
                )
              ]
            )
            (C {(fast_import_notes)} {(DQ (refs/notes/more_notes_) ($ Id.VSub_DollarName '$i'))} 
              {($ Id.VSub_DollarName '$some_commits')} {(input)} {(DQ (' (2)'))}
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:i)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName '$num_commits')}
          spids: [1676]
        )
      ]
    )
    (command.WhileUntil
      keyword: (Token id:Id.KW_While val:while span_id:1679)
      cond: [(C {(test)} {($ Id.VSub_DollarName '$i')} {(-gt)} {(0)})]
      body: 
        (command.DoGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:note_data)
                  op: assign_op.Equal
                  rhs: {(DQ ('note for commit #') ($ Id.VSub_DollarName '$i'))}
                  spids: [1692]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (C {(test)} {($ Id.VSub_DollarName '$i')} {(-le)} 
                      {($ Id.VSub_DollarName '$some_commits')}
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:note_data)
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName '$note_data') (' (2)'))}
                          spids: [1713]
                        )
                      ]
                    )
                  ]
                  spids: [1699 1710]
                )
              ]
            )
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:1725)
                  fd: -1
                  arg_word: {(expect)}
                )
                (redir.HereDoc
                  op: (Token id:Id.Redir_DLess val:'<<' span_id:1728)
                  fd: -1
                  here_begin: {(EXPECT_END)}
                  here_end_span_id: 1738
                  stdin_parts: [
                    ('    commit #')
                    ($ Id.VSub_DollarName '$i')
                    ('\n')
                    ('    ')
                    ($ Id.VSub_DollarName '$note_data')
                    ('\n')
                  ]
                )
              ]
            )
            (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: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                            right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                          )
                      )
                    }
                  spids: [1740]
                )
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {
        (DQ ('add notes to ') ($ Id.VSub_DollarName '$num_commits') (' commits in each of ') 
          ($ Id.VSub_DollarName '$num_notes_refs') (' refs')
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:1764) 
          (Token id:Id.Lit_Chars val:'\n' span_id:1765) (Token id:Id.Lit_Chars val:'\tgit fast-import --active-branches=5 <input &&\n' span_id:1766) 
          (Token
            id: Id.Lit_Chars
            val: '\tGIT_NOTES_REF=refs/notes/more_notes_1 git log refs/heads/more_commits |\n'
            span_id: 1767
          ) (Token id:Id.Lit_Chars val:'\t    grep "^    " > actual &&\n' span_id:1768) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual\n' span_id:1769) (Token id:Id.Lit_Chars val:'\n' span_id:1770)
        )
      }
    )
    (C {(test_done)})
  ]
)