(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 merging of notes trees' span_id:15))}
          spids: [13]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:29) 
          (Token id:Id.Lit_Chars val:'\ttest_commit 1st &&\n' span_id:30) (Token id:Id.Lit_Chars val:'\ttest_commit 2nd &&\n' span_id:31) 
          (Token id:Id.Lit_Chars val:'\ttest_commit 3rd &&\n' span_id:32) (Token id:Id.Lit_Chars val:'\ttest_commit 4th &&\n' span_id:33) 
          (Token id:Id.Lit_Chars val:'\ttest_commit 5th &&\n' span_id:34) (Token id:Id.Lit_Chars val:'\t# Create notes on 4 first commits\n' span_id:35) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/x &&\n'
            span_id: 36
          ) (Token id:Id.Lit_Chars val:'\tgit notes add -m "Notes on 1st commit" 1st &&\n' span_id:37) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes add -m "Notes on 2nd commit" 2nd &&\n'
            span_id: 38
          ) (Token id:Id.Lit_Chars val:'\tgit notes add -m "Notes on 3rd commit" 3rd &&\n' span_id:39) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes add -m "Notes on 4th commit" 4th &&\n'
            span_id: 40
          ) (Token id:Id.Lit_Chars val:'\t# Copy notes to remote-notes\n' span_id:41) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit fetch . refs/notes/*:refs/remote-notes/origin/*\n'
            span_id: 42
          )
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit_sha1)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:47)
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(git)} {(rev-parse)} 
                        {(1st) (Id.Lit_Other '^') (Id.Lit_LBrace '{') (commit) (Id.Lit_RBrace '}')}
                      )
                    ]
                  )
              )
            }
          spids: [46]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit_sha2)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:60)
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(git)} {(rev-parse)} 
                        {(2nd) (Id.Lit_Other '^') (Id.Lit_LBrace '{') (commit) (Id.Lit_RBrace '}')}
                      )
                    ]
                  )
              )
            }
          spids: [59]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit_sha3)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:73)
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(git)} {(rev-parse)} 
                        {(3rd) (Id.Lit_Other '^') (Id.Lit_LBrace '{') (commit) (Id.Lit_RBrace '}')}
                      )
                    ]
                  )
              )
            }
          spids: [72]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit_sha4)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:86)
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(git)} {(rev-parse)} 
                        {(4th) (Id.Lit_Other '^') (Id.Lit_LBrace '{') (commit) (Id.Lit_RBrace '}')}
                      )
                    ]
                  )
              )
            }
          spids: [85]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:commit_sha5)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:99)
                command_list: 
                  (command.CommandList
                    children: [
                      (C {(git)} {(rev-parse)} 
                        {(5th) (Id.Lit_Other '^') (Id.Lit_LBrace '{') (commit) (Id.Lit_RBrace '}')}
                      )
                    ]
                  )
              )
            }
          spids: [98]
        )
      ]
    )
    (command.ShFunction
      name: verify_notes
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:notes_ref)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [120]
                )
              ]
            )
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Pipeline
                  children: [
                    (C {(git)} {(-c)} 
                      {(core.notesRef) (Id.Lit_Equals '=') 
                        (DQ (refs/notes/) ($ Id.VSub_DollarName '$notes_ref'))
                      } {(notes)}
                    )
                    (command.Simple
                      words: [{(sort)}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_Great val:'>' span_id:144)
                          fd: -1
                          arg_word: {(DQ (output_notes_) ($ Id.VSub_DollarName '$notes_ref'))}
                        )
                      ]
                    )
                  ]
                  negated: F
                )
                (C {(test_cmp)} {(DQ (expect_notes_) ($ Id.VSub_DollarName '$notes_ref'))} 
                  {(DQ (output_notes_) ($ Id.VSub_DollarName '$notes_ref'))}
                )
                (command.Simple
                  words: [
                    {(git)}
                    {(-c)}
                    {(core.notesRef) (Id.Lit_Equals '=') 
                      (DQ (refs/notes/) ($ Id.VSub_DollarName '$notes_ref'))
                    }
                    {(log)}
                    {(--format) (Id.Lit_Equals '=') (DQ ('%H %s%n%N'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:189)
                      fd: -1
                      arg_word: {(DQ (output_log_) ($ Id.VSub_DollarName '$notes_ref'))}
                    )
                  ]
                )
                (C {(test_cmp)} {(DQ (expect_log_) ($ Id.VSub_DollarName '$notes_ref'))} 
                  {(DQ (output_log_) ($ Id.VSub_DollarName '$notes_ref'))}
                )
              ]
            )
          ]
        )
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:215)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 238
              stdin_parts: [
                ('5e93d24084d32e1cb61f7070505b9d2530cca987 ')
                ($ Id.VSub_DollarName '$commit_sha4')
                ('\n')
                ('8366731eeee53787d2bdf8fc1eff7d94757e8da0 ')
                ($ Id.VSub_DollarName '$commit_sha3')
                ('\n')
                ('eede89064cd42441590d6afec6c37b321ada3389 ')
                ($ Id.VSub_DollarName '$commit_sha2')
                ('\n')
                ('daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 ')
                ($ Id.VSub_DollarName '$commit_sha1')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:222)
              fd: -1
              arg_word: {(expect_notes_x)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:242)
          fd: -1
          arg_word: {(expect_log_x)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:245)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 268
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('Notes on 4th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('Notes on 3rd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('Notes on 2nd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('Notes on 1st commit\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'verify initial notes (x)' span_id:273))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:277) 
          (Token id:Id.Lit_Chars val:'\tverify_notes x\n' span_id:278)
        )
      }
    )
    (C {(cp)} {(expect_notes_x)} {(expect_notes_y)})
    (C {(cp)} {(expect_notes_x)} {(expect_notes_v)})
    (C {(cp)} {(expect_log_x)} {(expect_log_y)})
    (C {(cp)} {(expect_log_x)} {(expect_log_v)})
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'fail to merge empty notes ref into empty notes ref (z => y)'
            span_id: 310
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:314) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/y" notes merge z\n'
            span_id: 315
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'fail to merge into various non-notes refs' span_id:322))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:326) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes" notes merge x &&\n'
            span_id: 327
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/" notes merge x &&\n'
            span_id: 328
          ) (Token id:Id.Lit_Chars val:'\tmkdir -p .git/refs/notes/dir &&\n' span_id:329) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/dir" notes merge x &&\n'
            span_id: 330
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/dir/" notes merge x &&\n'
            span_id: 331
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/heads/master" notes merge x &&\n'
            span_id: 332
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/y:" notes merge x &&\n'
            span_id: 333
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/y:foo" notes merge x &&\n'
            span_id: 334
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -c "core.notesRef=refs/notes/foo^{bar" notes merge x\n'
            span_id: 335
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'merge non-notes ref into empty notes ref (remote-notes/origin/x => v)'
            span_id: 342
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:346) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/v &&\n'
            span_id: 347
          ) (Token id:Id.Lit_Chars val:'\tgit notes merge refs/remote-notes/origin/x &&\n' span_id:348) 
          (Token id:Id.Lit_Chars val:'\tverify_notes v &&\n' span_id:349) 
          (Token
            id: Id.Lit_Chars
            val: '\t# refs/remote-notes/origin/x and v should point to the same notes commit\n'
            span_id: 350
          ) 
          (Token
            id: Id.Lit_Chars
            val: 
'\ttest "$(git rev-parse refs/remote-notes/origin/x)" = "$(git rev-parse refs/notes/v)"\n'
            span_id: 351
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'merge notes into empty notes ref (x => y)' span_id:358))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:362) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/y &&\n'
            span_id: 363
          ) (Token id:Id.Lit_Chars val:'\tgit notes merge x &&\n' span_id:364) 
          (Token id:Id.Lit_Chars val:'\tverify_notes y &&\n' span_id:365) (Token id:Id.Lit_Chars val:'\t# x and y should point to the same notes commit\n' span_id:366) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest "$(git rev-parse refs/notes/x)" = "$(git rev-parse refs/notes/y)"\n'
            span_id: 367
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'merge empty notes ref (z => y)' span_id:374))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:378) 
          (Token id:Id.Lit_Chars val:'\tgit notes merge z &&\n' span_id:379) (Token id:Id.Lit_Chars val:'\t# y should not change (still == x)\n' span_id:380) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest "$(git rev-parse refs/notes/x)" = "$(git rev-parse refs/notes/y)"\n'
            span_id: 381
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'change notes on other notes ref (y)' span_id:388))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:392) 
          (Token id:Id.Lit_Chars val:'\t# Not touching notes to 1st commit\n' span_id:393) (Token id:Id.Lit_Chars val:'\tgit notes remove 2nd &&\n' span_id:394) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes append -m "More notes on 3rd commit" 3rd &&\n'
            span_id: 395
          ) (Token id:Id.Lit_Chars val:'\tgit notes add -f -m "New notes on 4th commit" 4th &&\n' span_id:396) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes add -m "Notes on 5th commit" 5th\n'
            span_id: 397
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'merge previous notes commit (y^ => y) => No-op' span_id:404))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:408) 
          (Token
            id: Id.Lit_Chars
            val: '\tpre_state="$(git rev-parse refs/notes/y)" &&\n'
            span_id: 409
          ) (Token id:Id.Lit_Chars val:'\tgit notes merge y^ &&\n' span_id:410) 
          (Token id:Id.Lit_Chars val:'\t# y should not move\n' span_id:411) (Token id:Id.Lit_Chars val:'\ttest "$pre_state" = "$(git rev-parse refs/notes/y)"\n' span_id:412)
        )
      }
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:418)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 441
              stdin_parts: [
                ('0f2efbd00262f2fd41dfae33df8765618eeacd99 ')
                ($ Id.VSub_DollarName '$commit_sha5')
                ('\n')
                ('dec2502dac3ea161543f71930044deff93fa945c ')
                ($ Id.VSub_DollarName '$commit_sha4')
                ('\n')
                ('4069cdb399fd45463ec6eef8e051a16a03592d91 ')
                ($ Id.VSub_DollarName '$commit_sha3')
                ('\n')
                ('daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 ')
                ($ Id.VSub_DollarName '$commit_sha1')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:425)
              fd: -1
              arg_word: {(expect_notes_y)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:445)
          fd: -1
          arg_word: {(expect_log_y)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:448)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 473
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('Notes on 5th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('New notes on 4th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('Notes on 3rd commit\n')
            ('\n')
            ('More notes on 3rd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('Notes on 1st commit\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'verify changed notes on other notes ref (y)' span_id:478))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:482) 
          (Token id:Id.Lit_Chars val:'\tverify_notes y\n' span_id:483)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'verify unchanged notes on original notes ref (x)'
            span_id: 490
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:494) 
          (Token id:Id.Lit_Chars val:'\tverify_notes x\n' span_id:495)
        )
      }
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'merge original notes (x) into changed notes (y) => No-op'
            span_id: 502
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:506) 
          (Token id:Id.Lit_Chars val:'\tgit notes merge -vvv x &&\n' span_id:507) (Token id:Id.Lit_Chars val:'\tverify_notes y &&\n' span_id:508) 
          (Token id:Id.Lit_Chars val:'\tverify_notes x\n' span_id:509)
        )
      }
    )
    (C {(cp)} {(expect_notes_y)} {(expect_notes_x)})
    (C {(cp)} {(expect_log_y)} {(expect_log_x)})
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'merge changed (y) into original (x) => Fast-forward'
            span_id: 529
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:533) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/x &&\n'
            span_id: 534
          ) (Token id:Id.Lit_Chars val:'\tgit notes merge y &&\n' span_id:535) 
          (Token id:Id.Lit_Chars val:'\tverify_notes x &&\n' span_id:536) (Token id:Id.Lit_Chars val:'\tverify_notes y &&\n' span_id:537) 
          (Token
            id: Id.Lit_Chars
            val: '\t# x and y should point to same the notes commit\n'
            span_id: 538
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest "$(git rev-parse refs/notes/x)" = "$(git rev-parse refs/notes/y)"\n'
            span_id: 539
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'merge empty notes ref (z => y)' span_id:546))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:550) 
          (Token
            id: Id.Lit_Chars
            val: '\t# Prepare empty (but valid) notes ref (z)\n'
            span_id: 551
          ) (Token id:Id.Lit_Chars val:'\tgit config core.notesRef refs/notes/z &&\n' span_id:552) 
          (Token id:Id.Lit_Chars val:'\tgit notes add -m "foo" &&\n' span_id:553) (Token id:Id.Lit_Chars val:'\tgit notes remove &&\n' span_id:554) 
          (Token id:Id.Lit_Chars val:'\tgit notes >output_notes_z &&\n' span_id:555) (Token id:Id.Lit_Chars val:'\ttest_cmp /dev/null output_notes_z &&\n' span_id:556) 
          (Token id:Id.Lit_Chars val:'\t# Do the merge (z => y)\n' span_id:557) (Token id:Id.Lit_Chars val:'\tgit config core.notesRef refs/notes/y &&\n' span_id:558) 
          (Token id:Id.Lit_Chars val:'\tgit notes merge z &&\n' span_id:559) (Token id:Id.Lit_Chars val:'\tverify_notes y &&\n' span_id:560) 
          (Token
            id: Id.Lit_Chars
            val: '\t# y should no longer point to the same notes commit as x\n'
            span_id: 561
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest "$(git rev-parse refs/notes/x)" != "$(git rev-parse refs/notes/y)"\n'
            span_id: 562
          )
        )
      }
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:568)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 594
              stdin_parts: [
                ('0f2efbd00262f2fd41dfae33df8765618eeacd99 ')
                ($ Id.VSub_DollarName '$commit_sha5')
                ('\n')
                ('dec2502dac3ea161543f71930044deff93fa945c ')
                ($ Id.VSub_DollarName '$commit_sha4')
                ('\n')
                ('4069cdb399fd45463ec6eef8e051a16a03592d91 ')
                ($ Id.VSub_DollarName '$commit_sha3')
                ('\n')
                ('d000d30e6ddcfce3a8122c403226a2ce2fd04d9d ')
                ($ Id.VSub_DollarName '$commit_sha2')
                ('\n')
                ('43add6bd0c8c0bc871ac7991e0f5573cfba27804 ')
                ($ Id.VSub_DollarName '$commit_sha1')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:575)
              fd: -1
              arg_word: {(expect_notes_y)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:598)
          fd: -1
          arg_word: {(expect_log_y)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:601)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 629
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('Notes on 5th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('New notes on 4th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('Notes on 3rd commit\n')
            ('\n')
            ('More notes on 3rd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('New notes on 2nd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('Notes on 1st commit\n')
            ('\n')
            ('More notes on 1st commit\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'change notes on other notes ref (y)' span_id:634))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:638) 
          (Token id:Id.Lit_Chars val:'\t# Append to 1st commit notes\n' span_id:639) (Token id:Id.Lit_Chars val:'\tgit notes append -m "More notes on 1st commit" 1st &&\n' span_id:640) 
          (Token id:Id.Lit_Chars val:'\t# Add new notes to 2nd commit\n' span_id:641) (Token id:Id.Lit_Chars val:'\tgit notes add -m "New notes on 2nd commit" 2nd &&\n' span_id:642) 
          (Token id:Id.Lit_Chars val:'\tverify_notes y\n' span_id:643)
        )
      }
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:649)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 669
              stdin_parts: [
                ('0f2efbd00262f2fd41dfae33df8765618eeacd99 ')
                ($ Id.VSub_DollarName '$commit_sha5')
                ('\n')
                ('1f257a3a90328557c452f0817d6cc50c89d315d4 ')
                ($ Id.VSub_DollarName '$commit_sha4')
                ('\n')
                ('daa55ffad6cb99bf64226532147ffcaf5ce8bdd1 ')
                ($ Id.VSub_DollarName '$commit_sha1')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:656)
              fd: -1
              arg_word: {(expect_notes_x)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:673)
          fd: -1
          arg_word: {(expect_log_x)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:676)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 700
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('Notes on 5th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('New notes on 4th commit\n')
            ('\n')
            ('More notes on 4th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('Notes on 1st commit\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'change notes on notes ref (x)' span_id:705))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:709) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/x &&\n'
            span_id: 710
          ) (Token id:Id.Lit_Chars val:'\tgit notes remove 3rd &&\n' span_id:711) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes append -m "More notes on 4th commit" 4th &&\n'
            span_id: 712
          ) (Token id:Id.Lit_Chars val:'\tverify_notes x\n' span_id:713)
        )
      }
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:719)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 742
              stdin_parts: [
                ('0f2efbd00262f2fd41dfae33df8765618eeacd99 ')
                ($ Id.VSub_DollarName '$commit_sha5')
                ('\n')
                ('1f257a3a90328557c452f0817d6cc50c89d315d4 ')
                ($ Id.VSub_DollarName '$commit_sha4')
                ('\n')
                ('d000d30e6ddcfce3a8122c403226a2ce2fd04d9d ')
                ($ Id.VSub_DollarName '$commit_sha2')
                ('\n')
                ('43add6bd0c8c0bc871ac7991e0f5573cfba27804 ')
                ($ Id.VSub_DollarName '$commit_sha1')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:726)
              fd: -1
              arg_word: {(expect_notes_x)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:746)
          fd: -1
          arg_word: {(expect_log_x)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:749)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 776
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('Notes on 5th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('New notes on 4th commit\n')
            ('\n')
            ('More notes on 4th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('New notes on 2nd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('Notes on 1st commit\n')
            ('\n')
            ('More notes on 1st commit\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'merge y into x => Non-conflicting 3-way merge' span_id:781))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:785) 
          (Token id:Id.Lit_Chars val:'\tgit notes merge y &&\n' span_id:786) (Token id:Id.Lit_Chars val:'\tverify_notes x &&\n' span_id:787) 
          (Token id:Id.Lit_Chars val:'\tverify_notes y\n' span_id:788)
        )
      }
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:794)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 811
              stdin_parts: [
                ('05a4927951bcef347f51486575b878b2b60137f2 ')
                ($ Id.VSub_DollarName '$commit_sha3')
                ('\n')
                ('d000d30e6ddcfce3a8122c403226a2ce2fd04d9d ')
                ($ Id.VSub_DollarName '$commit_sha2')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:801)
              fd: -1
              arg_word: {(expect_notes_w)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:815)
          fd: -1
          arg_word: {(expect_log_w)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:818)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 839
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('New notes on 3rd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('New notes on 2nd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'create notes on new, separate notes ref (w)' span_id:844))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:848) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/w &&\n'
            span_id: 849
          ) (Token id:Id.Lit_Chars val:'\t# Add same note as refs/notes/y on 2nd commit\n' span_id:850) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes add -m "New notes on 2nd commit" 2nd &&\n'
            span_id: 851
          ) (Token id:Id.Lit_Chars val:'\t# Add new note on 3rd commit (non-conflicting)\n' span_id:852) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit notes add -m "New notes on 3rd commit" 3rd &&\n'
            span_id: 853
          ) (Token id:Id.Lit_Chars val:'\t# Verify state of notes on new, separate notes ref (w)\n' span_id:854) 
          (Token id:Id.Lit_Chars val:'\tverify_notes w\n' span_id:855)
        )
      }
    )
    (command.Pipeline
      children: [
        (command.Simple
          words: [{(cat)}]
          redirects: [
            (redir.HereDoc
              op: (Token id:Id.Redir_DLess val:'<<' span_id:861)
              fd: -1
              here_begin: {(EOF)}
              here_end_span_id: 887
              stdin_parts: [
                ('0f2efbd00262f2fd41dfae33df8765618eeacd99 ')
                ($ Id.VSub_DollarName '$commit_sha5')
                ('\n')
                ('1f257a3a90328557c452f0817d6cc50c89d315d4 ')
                ($ Id.VSub_DollarName '$commit_sha4')
                ('\n')
                ('05a4927951bcef347f51486575b878b2b60137f2 ')
                ($ Id.VSub_DollarName '$commit_sha3')
                ('\n')
                ('d000d30e6ddcfce3a8122c403226a2ce2fd04d9d ')
                ($ Id.VSub_DollarName '$commit_sha2')
                ('\n')
                ('43add6bd0c8c0bc871ac7991e0f5573cfba27804 ')
                ($ Id.VSub_DollarName '$commit_sha1')
                ('\n')
              ]
            )
          ]
        )
        (command.Simple
          words: [{(sort)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:868)
              fd: -1
              arg_word: {(expect_notes_x)}
            )
          ]
        )
      ]
      negated: F
    )
    (command.Simple
      words: [{(cat)}]
      redirects: [
        (redir.Redir
          op: (Token id:Id.Redir_Great val:'>' span_id:891)
          fd: -1
          arg_word: {(expect_log_x)}
        )
        (redir.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:894)
          fd: -1
          here_begin: {(EOF)}
          here_end_span_id: 922
          stdin_parts: [
            ($ Id.VSub_DollarName '$commit_sha5')
            (' 5th\n')
            ('Notes on 5th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha4')
            (' 4th\n')
            ('New notes on 4th commit\n')
            ('\n')
            ('More notes on 4th commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha3')
            (' 3rd\n')
            ('New notes on 3rd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha2')
            (' 2nd\n')
            ('New notes on 2nd commit\n')
            ('\n')
            ($ Id.VSub_DollarName '$commit_sha1')
            (' 1st\n')
            ('Notes on 1st commit\n')
            ('\n')
            ('More notes on 1st commit\n')
            ('\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} 
      {
        (SQ 
          (Token
            id: Id.Lit_Chars
            val: 'merge w into x => Non-conflicting history-less merge'
            span_id: 927
          )
        )
      } 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:931) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config core.notesRef refs/notes/x &&\n'
            span_id: 932
          ) (Token id:Id.Lit_Chars val:'\tgit notes merge w &&\n' span_id:933) 
          (Token
            id: Id.Lit_Chars
            val: '\t# Verify new state of notes on other notes ref (x)\n'
            span_id: 934
          ) (Token id:Id.Lit_Chars val:'\tverify_notes x &&\n' span_id:935) 
          (Token
            id: Id.Lit_Chars
            val: '\t# Also verify that nothing changed on other notes refs (y and w)\n'
            span_id: 936
          ) (Token id:Id.Lit_Chars val:'\tverify_notes y &&\n' span_id:937) 
          (Token id:Id.Lit_Chars val:'\tverify_notes w\n' span_id:938)
        )
      }
    )
    (C {(test_done)})
  ]
)