(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:'merge simplification' span_id:6))}
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.ShFunction
      name: note
      body: (command.BraceGroup children:[(C {(git)} {(tag)} {(DQ ($ Id.VSub_Number '$1'))})])
    )
    (command.ShFunction
      name: unnote
      body: 
        (command.BraceGroup
          children: [
            (command.Pipeline
              children: [
                (C {(git)} {(name-rev)} {(--tags)} {(--stdin)})
                (C {(sed)} {(-e)} 
                  {
                    (DQ ('s|') ($ Id.VSub_DollarName '$_x40') (' (tags/') (Id.Lit_Other '\\') ('([^)]*') 
                      (Id.Lit_Other '\\') (')) |') (Id.Lit_Other '\\') ('1 |g')
                    )
                  }
                )
              ]
              negated: F
            )
          ]
        )
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:76) 
          (Token id:Id.Lit_Chars val:'\techo "Hi there" >file &&\n' span_id:77) (Token id:Id.Lit_Chars val:'\techo "initial" >lost &&\n' span_id:78) 
          (Token id:Id.Lit_Chars val:'\tgit add file lost &&\n' span_id:79) (Token id:Id.Lit_Chars val:'\ttest_tick && git commit -m "Initial file and lost" &&\n' span_id:80) 
          (Token id:Id.Lit_Chars val:'\tnote A &&\n' span_id:81) (Token id:Id.Lit_Chars val:'\n' span_id:82) 
          (Token id:Id.Lit_Chars val:'\tgit branch other-branch &&\n' span_id:83) (Token id:Id.Lit_Chars val:'\n' span_id:84) 
          (Token id:Id.Lit_Chars val:'\techo "Hello" >file &&\n' span_id:85) (Token id:Id.Lit_Chars val:'\techo "second" >lost &&\n' span_id:86) 
          (Token id:Id.Lit_Chars val:'\tgit add file lost &&\n' span_id:87) (Token id:Id.Lit_Chars val:'\ttest_tick && git commit -m "Modified file and lost" &&\n' span_id:88) 
          (Token id:Id.Lit_Chars val:'\tnote B &&\n' span_id:89) (Token id:Id.Lit_Chars val:'\n' span_id:90) 
          (Token id:Id.Lit_Chars val:'\tgit checkout other-branch &&\n' span_id:91) (Token id:Id.Lit_Chars val:'\n' span_id:92) 
          (Token id:Id.Lit_Chars val:'\techo "Hello" >file &&\n' span_id:93) (Token id:Id.Lit_Chars val:'\t>lost &&\n' span_id:94) 
          (Token id:Id.Lit_Chars val:'\tgit add file lost &&\n' span_id:95) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git commit -m "Modified the file identically" &&\n'
            span_id: 96
          ) (Token id:Id.Lit_Chars val:'\tnote C &&\n' span_id:97) (Token id:Id.Lit_Chars val:'\n' span_id:98) 
          (Token
            id: Id.Lit_Chars
            val: '\techo "This is a stupid example" >another-file &&\n'
            span_id: 99
          ) (Token id:Id.Lit_Chars val:'\tgit add another-file &&\n' span_id:100) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git commit -m "Add another file" &&\n'
            span_id: 101
          ) (Token id:Id.Lit_Chars val:'\tnote D &&\n' span_id:102) (Token id:Id.Lit_Chars val:'\n' span_id:103) 
          (Token id:Id.Lit_Chars val:'\ttest_tick &&\n' span_id:104) (Token id:Id.Lit_Chars val:'\ttest_must_fail git merge -m "merge" master &&\n' span_id:105) 
          (Token
            id: Id.Lit_Chars
            val: '\t>lost && git commit -a -m "merge" &&\n'
            span_id: 106
          ) (Token id:Id.Lit_Chars val:'\tnote E &&\n' span_id:107) (Token id:Id.Lit_Chars val:'\n' span_id:108) 
          (Token id:Id.Lit_Chars val:'\techo "Yet another" >elif &&\n' span_id:109) (Token id:Id.Lit_Chars val:'\tgit add elif &&\n' span_id:110) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git commit -m "Irrelevant change" &&\n'
            span_id: 111
          ) (Token id:Id.Lit_Chars val:'\tnote F &&\n' span_id:112) (Token id:Id.Lit_Chars val:'\n' span_id:113) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:114) (Token id:Id.Lit_Chars val:'\techo "Yet another" >elif &&\n' span_id:115) 
          (Token id:Id.Lit_Chars val:'\tgit add elif &&\n' span_id:116) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git commit -m "Another irrelevant change" &&\n'
            span_id: 117
          ) (Token id:Id.Lit_Chars val:'\tnote G &&\n' span_id:118) (Token id:Id.Lit_Chars val:'\n' span_id:119) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git merge -m "merge" other-branch &&\n'
            span_id: 120
          ) (Token id:Id.Lit_Chars val:'\tnote H &&\n' span_id:121) (Token id:Id.Lit_Chars val:'\n' span_id:122) 
          (Token id:Id.Lit_Chars val:'\techo "Final change" >file &&\n' span_id:123) (Token id:Id.Lit_Chars val:'\ttest_tick && git commit -a -m "Final change" &&\n' span_id:124) 
          (Token id:Id.Lit_Chars val:'\tnote I &&\n' span_id:125) (Token id:Id.Lit_Chars val:'\n' span_id:126) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit symbolic-ref HEAD refs/heads/unrelated &&\n'
            span_id: 127
          ) (Token id:Id.Lit_Chars val:'\tgit rm -f "*" &&\n' span_id:128) 
          (Token id:Id.Lit_Chars val:'\techo "Unrelated branch" >side &&\n' span_id:129) (Token id:Id.Lit_Chars val:'\tgit add side &&\n' span_id:130) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git commit -m "Side root" &&\n'
            span_id: 131
          ) (Token id:Id.Lit_Chars val:'\tnote J &&\n' span_id:132) (Token id:Id.Lit_Chars val:'\n' span_id:133) 
          (Token id:Id.Lit_Chars val:'\tgit checkout master &&\n' span_id:134) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git merge --allow-unrelated-histories -m "Coolest" unrelated &&\n'
            span_id: 135
          ) (Token id:Id.Lit_Chars val:'\tnote K &&\n' span_id:136) (Token id:Id.Lit_Chars val:'\n' span_id:137) 
          (Token id:Id.Lit_Chars val:'\techo "Immaterial" >elif &&\n' span_id:138) (Token id:Id.Lit_Chars val:'\tgit add elif &&\n' span_id:139) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_tick && git commit -m "Last" &&\n'
            span_id: 140
          ) (Token id:Id.Lit_Chars val:'\tnote L\n' span_id:141)
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:FMT)
          op: assign_op.Equal
          rhs: {(SQ (Token id:Id.Lit_Chars val:'tformat:%P \t%H | %s' span_id:147))}
          spids: [145]
        )
      ]
    )
    (command.ShFunction
      name: check_outcome
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:outcome)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [159]
                )
              ]
            )
            (C {(shift)})
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.ForEach
                  iter_name: c
                  iter_words: [{($ Id.VSub_Number '$1')}]
                  do_arg_iter: F
                  body: (command.DoGroup children:[(C {(echo)} {(DQ ($ Id.VSub_DollarName '$c'))})])
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:187)
                      fd: -1
                      arg_word: {(expect)}
                    )
                  ]
                )
                (C {(shift)})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:param)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Star '$*'))}
                      spids: [198]
                    )
                  ]
                )
                (C {(test_expect_) ($ Id.VSub_DollarName '$outcome')} 
                  {(DQ ('log ') ($ Id.VSub_DollarName '$param'))} 
                  {
                    (SQ (Token id:Id.Lit_Chars val:'\n' span_id:215) 
                      (Token
                        id: Id.Lit_Chars
                        val: '\t\tgit log --pretty="$FMT" --parents $param |\n'
                        span_id: 216
                      ) (Token id:Id.Lit_Chars val:'\t\tunnote >actual &&\n' span_id:217) 
                      (Token
                        id: Id.Lit_Chars
                        val: '\t\tsed -e "s/^.*\t\\([^ ]*\\) .*/\\1/" >check <actual &&\n'
                        span_id: 218
                      ) (Token id:Id.Lit_Chars val:'\t\ttest_cmp expect check\n' span_id:219) 
                      (Token id:Id.Lit_Chars val:'\t' span_id:220)
                    )
                  }
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: check_result
      body: 
        (command.BraceGroup
          children: [(C {(check_outcome)} {(success)} {(DQ ($ Id.VSub_At '$@'))})]
        )
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'L K J I H G F E D C B A' span_id:248))} 
      {(--full-history)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'K I H E C B A' span_id:256))} 
      {(--full-history)} {(--)} {(file)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'K I H E C B A' span_id:268))} 
      {(--full-history)} {(--topo-order)} {(--)} {(file)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'K I H E C B A' span_id:282))} 
      {(--full-history)} {(--date-order)} {(--)} {(file)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'I E C B A' span_id:296))} {(--simplify-merges)} 
      {(--)} {(file)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'I B A' span_id:308))} {(--)} {(file)})
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'I B A' span_id:318))} {(--topo-order)} {(--)} 
      {(file)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:H span_id:330))} {(--first-parent)} {(--)} 
      {(another-file)}
    )
    (C {(check_result)} {(SQ (Token id:Id.Lit_Chars val:'E C B A' span_id:343))} {(--full-history)} {(E)} 
      {(--)} {(lost)}
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'full history simplification without parent' span_id:357))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:361) 
          (Token id:Id.Lit_Chars val:'\tprintf "%s\\n" E C B A >expect &&\n' span_id:362) (Token id:Id.Lit_Chars val:'\tgit log --pretty="$FMT" --full-history E -- lost |\n' span_id:363) 
          (Token id:Id.Lit_Chars val:'\tunnote >actual &&\n' span_id:364) (Token id:Id.Lit_Chars val:'\tsed -e "s/^.*\t\\([^ ]*\\) .*/\\1/" >check <actual &&\n' span_id:365) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect check\n' span_id:366)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'--full-diff is not affected by --parents' span_id:373))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:377) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit log -p --pretty="%H" --full-diff -- file >expected &&\n'
            span_id: 378
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit log -p --pretty="%H" --full-diff --parents -- file >actual &&\n'
            span_id: 379
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expected actual\n' span_id:380)
        )
      }
    )
    (C {(test_done)})
  ]
)