(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Test notes trees that also contain non-notes'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:number_of_commits) op:Equal rhs:{(100)})]
    )
    (command.FuncDef
      name: start_note_commit
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp]
              children: [
                (C {(test_tick)})
                (command.SimpleCommand
                  words: [{(cat)}]
                  redirects: [
                    (redir.HereDoc
                      op: <Redir_DLess '<<'>
                      fd: 16777215
                      here_begin: {(INPUT_END)}
                      here_end_span_id: 52
                      stdin_parts: [
                        ('commit refs/notes/commits\n')
                        ('committer ')
                        ($ VSub_DollarName '$GIT_COMMITTER_NAME')
                        (' <')
                        ($ VSub_DollarName '$GIT_COMMITTER_EMAIL')
                        ('> ')
                        ($ VSub_DollarName '$GIT_COMMITTER_DATE')
                        ('\n')
                        ('data <<COMMIT\n')
                        ('notes\n')
                        ('COMMIT\n')
                        ('\n')
                        ('from refs/notes/commits^0\n')
                        ('deleteall\n')
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: verify_notes
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (command.Pipeline
                  children: [
                    (C {(git)} {(log)})
                    (command.SimpleCommand
                      words: [{(grep)} {(DQ ('^    '))}]
                      redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(output)})]
                    )
                  ]
                  negated: F
                )
                (command.Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (lhs_expr.LhsName name:i)
                      op: Equal
                      rhs: {($ VSub_DollarName '$number_of_commits')}
                    )
                  ]
                )
                (command.WhileUntil
                  keyword: <KW_While while>
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Lit_Other '[')} {($ VSub_DollarName '$i')} {(-gt)} {(0)} {(Lit_Other ']')})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  body: 
                    (command.DoGroup
                      children: [
                        (command.Sentence
                          child: 
                            (command.AndOr
                              ops: [Op_DAmp Op_DAmp]
                              children: [
                                (C {(echo)} {(DQ ('    commit #') ($ VSub_DollarName '$i'))})
                                (C {(echo)} {(DQ ('    note for commit #') ($ VSub_DollarName '$i'))})
                                (command.Assignment
                                  keyword: Assign_None
                                  pairs: [
                                    (assign_pair
                                      lhs: (lhs_expr.LhsName name:i)
                                      op: Equal
                                      rhs: 
                                        {
                                          (word_part.ArithSubPart
                                            anode: 
                                              (arith_expr.ArithBinary
                                                op_id: Arith_Minus
                                                left: 
                                                  (arith_expr.ArithWord
                                                    w: {($ VSub_DollarName '$i')}
                                                  )
                                                right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                                              )
                                          )
                                        }
                                    )
                                  ]
                                )
                              ]
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                    )
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})]
                )
                (C {(test_cmp)} {(expect)} {(output)})
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} {(DQ ('setup: create a couple of commits'))} 
      {
        (SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >input &&\n'> 
          <'commit refs/heads/master\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> 
          <'commit #1\n'> <'COMMIT\n'> <'\n'> <'M 644 inline file\n'> <'data <<EOF\n'> <'file in commit #1\n'> <'EOF\n'> <'\n'> 
          <'INPUT_END\n'> <'\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >>input &&\n'> <'commit refs/heads/master\n'> 
          <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'commit #2\n'> <'COMMIT\n'> <'\n'> <'M 644 inline file\n'> <'data <<EOF\n'> 
          <'file in commit #2\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\tgit fast-import --quiet <input\n'>
        )
      }
    )
    (C {(test_expect_success)} {(DQ ('create a notes tree with both notes and non-notes'))} 
      {
        (SQ <'\n'> <'\n'> <'\tcommit1=$(git rev-parse refs/heads/master^) &&\n'> 
          <'\tcommit2=$(git rev-parse refs/heads/master) &&\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >input &&\n'> <'commit refs/notes/commits\n'> 
          <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'notes commit #1\n'> <'COMMIT\n'> <'\n'> <'N inline $commit1\n'> <'data <<EOF\n'> 
          <'note for commit #1\n'> <'EOF\n'> <'\n'> <'N inline $commit2\n'> <'data <<EOF\n'> <'note for commit #2\n'> <'EOF\n'> <'\n'> 
          <'INPUT_END\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >>input &&\n'> <'commit refs/notes/commits\n'> 
          <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'notes commit #2\n'> <'COMMIT\n'> <'\n'> <'M 644 inline foobar/non-note.txt\n'> 
          <'data <<EOF\n'> <'A non-note in a notes tree\n'> <'EOF\n'> <'\n'> <'N inline $commit2\n'> <'data <<EOF\n'> 
          <'edited note for commit #2\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >>input &&\n'> 
          <'commit refs/notes/commits\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> 
          <'notes commit #3\n'> <'COMMIT\n'> <'\n'> <'N inline $commit1\n'> <'data <<EOF\n'> <'edited note for commit #1\n'> <'EOF\n'> 
          <'\n'> <'M 644 inline deadbeef\n'> <'data <<EOF\n'> <'non-note with SHA1-like name\n'> <'EOF\n'> <'\n'> 
          <'M 644 inline de/adbeef\n'> <'data <<EOF\n'> <'another non-note with SHA1-like name\n'> <'EOF\n'> <'\n'> 
          <'M 644 inline de/adbeefdeadbeefdeadbeefdeadbeefdeadbeef\n'> <'data <<EOF\n'> <'This is actually a valid note, albeit to a non-existing object.\n'> 
          <'It is needed in order to trigger the "mishandling" of the dead/beef non-note.\n'> <'EOF\n'> <'\n'> <'M 644 inline dead/beef\n'> <'data <<EOF\n'> 
          <'yet another non-note with SHA1-like name\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\tgit fast-import --quiet <input &&\n'> 
          <'\tgit config core.notesRef refs/notes/commits\n'>
        )
      }
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EXPECT_END)}
          here_end_span_id: 298
          stdin_parts: [
            ('    commit #2\n')
            ('    edited note for commit #2\n')
            ('    commit #1\n')
            ('    edited note for commit #1\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(DQ ('verify contents of notes'))} 
      {(SQ <'\n'> <'\n'> <'\tgit log | grep "^    " > actual &&\n'> <'\ttest_cmp expect actual\n'>)}
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn1)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EXPECT_END)}
          here_end_span_id: 324
          stdin_parts: [('A non-note in a notes tree\n')]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn2)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EXPECT_END)}
          here_end_span_id: 335
          stdin_parts: [('non-note with SHA1-like name\n')]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn3)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EXPECT_END)}
          here_end_span_id: 346
          stdin_parts: [('another non-note with SHA1-like name\n')]
        )
      ]
    )
    (command.SimpleCommand
      words: [{(cat)}]
      redirects: [
        (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn4)})
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(EXPECT_END)}
          here_end_span_id: 357
          stdin_parts: [('yet another non-note with SHA1-like name\n')]
        )
      ]
    )
    (C {(test_expect_success)} {(DQ ('verify contents of non-notes'))} 
      {
        (SQ <'\n'> <'\n'> 
          <'\tgit cat-file -p refs/notes/commits:foobar/non-note.txt > actual_nn1 &&\n'> <'\ttest_cmp expect_nn1 actual_nn1 &&\n'> 
          <'\tgit cat-file -p refs/notes/commits:deadbeef > actual_nn2 &&\n'> <'\ttest_cmp expect_nn2 actual_nn2 &&\n'> 
          <'\tgit cat-file -p refs/notes/commits:de/adbeef > actual_nn3 &&\n'> <'\ttest_cmp expect_nn3 actual_nn3 &&\n'> 
          <'\tgit cat-file -p refs/notes/commits:dead/beef > actual_nn4 &&\n'> <'\ttest_cmp expect_nn4 actual_nn4\n'>
        )
      }
    )
    (C {(test_expect_success)} {(DQ ('git-notes preserves non-notes'))} 
      {(SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> <'\tgit notes add -f -m "foo bar"\n'>)}
    )
    (C {(test_expect_success)} {(DQ ('verify contents of non-notes after git-notes'))} 
      {
        (SQ <'\n'> <'\n'> 
          <'\tgit cat-file -p refs/notes/commits:foobar/non-note.txt > actual_nn1 &&\n'> <'\ttest_cmp expect_nn1 actual_nn1 &&\n'> 
          <'\tgit cat-file -p refs/notes/commits:deadbeef > actual_nn2 &&\n'> <'\ttest_cmp expect_nn2 actual_nn2 &&\n'> 
          <'\tgit cat-file -p refs/notes/commits:de/adbeef > actual_nn3 &&\n'> <'\ttest_cmp expect_nn3 actual_nn3 &&\n'> 
          <'\tgit cat-file -p refs/notes/commits:dead/beef > actual_nn4 &&\n'> <'\ttest_cmp expect_nn4 actual_nn4\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)