(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"merge simplification">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: note
      body: (BraceGroup children:[(C {(git)} {(tag)} {(DQ ($ VSub_Number "$1"))})] spids:[20])
      spids: [15 19]
    )
    (FuncDef
      name: unnote
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (C {(git)} {(name-rev)} {(--tags)} {(--stdin)})
                (C {(sed)} {(-e)} 
                  {
                    (DQ ("s|") ($ VSub_Name "$_x40") (" (tags/") 
                      (EscapedLiteralPart token:<Lit_EscapedChar "\\(">) ("[^)]*") (EscapedLiteralPart token:<Lit_EscapedChar "\\)">) (") |") 
                      (EscapedLiteralPart token:<Lit_EscapedChar "\\1">) (" |g")
                    )
                  }
                )
              ]
              negated: False
            )
          ]
          spids: [39]
        )
      spids: [34 38]
    )
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <"\n"> <"\techo \"Hi there\" >file &&\n"> <"\techo \"initial\" >lost &&\n"> 
          <"\tgit add file lost &&\n"> <"\ttest_tick && git commit -m \"Initial file and lost\" &&\n"> <"\tnote A &&\n"> <"\n"> 
          <"\tgit branch other-branch &&\n"> <"\n"> <"\techo \"Hello\" >file &&\n"> <"\techo \"second\" >lost &&\n"> <"\tgit add file lost &&\n"> 
          <"\ttest_tick && git commit -m \"Modified file and lost\" &&\n"> <"\tnote B &&\n"> <"\n"> <"\tgit checkout other-branch &&\n"> <"\n"> <"\techo \"Hello\" >file &&\n"> 
          <"\t>lost &&\n"> <"\tgit add file lost &&\n"> <"\ttest_tick && git commit -m \"Modified the file identically\" &&\n"> 
          <"\tnote C &&\n"> <"\n"> <"\techo \"This is a stupid example\" >another-file &&\n"> <"\tgit add another-file &&\n"> 
          <"\ttest_tick && git commit -m \"Add another file\" &&\n"> <"\tnote D &&\n"> <"\n"> <"\ttest_tick &&\n"> <"\ttest_must_fail git merge -m \"merge\" master &&\n"> 
          <"\t>lost && git commit -a -m \"merge\" &&\n"> <"\tnote E &&\n"> <"\n"> <"\techo \"Yet another\" >elif &&\n"> <"\tgit add elif &&\n"> 
          <"\ttest_tick && git commit -m \"Irrelevant change\" &&\n"> <"\tnote F &&\n"> <"\n"> <"\tgit checkout master &&\n"> <"\techo \"Yet another\" >elif &&\n"> 
          <"\tgit add elif &&\n"> <"\ttest_tick && git commit -m \"Another irrelevant change\" &&\n"> <"\tnote G &&\n"> <"\n"> 
          <"\ttest_tick && git merge -m \"merge\" other-branch &&\n"> <"\tnote H &&\n"> <"\n"> <"\techo \"Final change\" >file &&\n"> 
          <"\ttest_tick && git commit -a -m \"Final change\" &&\n"> <"\tnote I &&\n"> <"\n"> <"\tgit symbolic-ref HEAD refs/heads/unrelated &&\n"> 
          <"\tgit rm -f \"*\" &&\n"> <"\techo \"Unrelated branch\" >side &&\n"> <"\tgit add side &&\n"> 
          <"\ttest_tick && git commit -m \"Side root\" &&\n"> <"\tnote J &&\n"> <"\n"> <"\tgit checkout master &&\n"> 
          <"\ttest_tick && git merge --allow-unrelated-histories -m \"Coolest\" unrelated &&\n"> <"\tnote K &&\n"> <"\n"> <"\techo \"Immaterial\" >elif &&\n"> <"\tgit add elif &&\n"> 
          <"\ttest_tick && git commit -m \"Last\" &&\n"> <"\tnote L\n">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:FMT)
          op: Equal
          rhs: {(SQ <"tformat:%P \t%H | %s">)}
          spids: [145]
        )
      ]
      spids: [145]
    )
    (FuncDef
      name: check_outcome
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:outcome)
                  op: Equal
                  rhs: {($ VSub_Number "$1")}
                  spids: [159]
                )
              ]
              spids: [159]
            )
            (C {(shift)})
            (AndOr
              children: [
                (ForEach
                  iter_name: c
                  iter_words: [{($ VSub_Number "$1")}]
                  do_arg_iter: False
                  body: (DoGroup children:[(C {(echo)} {(DQ ($ VSub_Name "$c"))})] spids:[175185])
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[187])]
                  spids: [171 -1]
                )
                (AndOr
                  children: [
                    (C {(shift)})
                    (AndOr
                      children: [
                        (Assignment
                          keyword: Assign_None
                          pairs: [
                            (assign_pair
                              lhs: (LhsName name:param)
                              op: Equal
                              rhs: {(DQ ($ VSub_Star "$*"))}
                              spids: [198]
                            )
                          ]
                          spids: [198]
                        )
                        (C {(test_expect_) ($ VSub_Name "$outcome")} 
                          {(DQ ("log ") ($ VSub_Name "$param"))} 
                          {
                            (SQ <"\n"> <"\t\tgit log --pretty=\"$FMT\" --parents $param |\n"> 
                              <"\t\tunnote >actual &&\n"> <"\t\tsed -e \"s/^.*\t\\([^ ]*\\) .*/\\1/\" >check <actual &&\n"> <"\t\ttest_cmp expect check\n"> 
                              <"\t">
                            )
                          }
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [156]
        )
      spids: [151 155]
    )
    (FuncDef
      name: check_result
      body: 
        (BraceGroup
          children: [(C {(check_outcome)} {(success)} {(DQ ($ VSub_At "$@"))})]
          spids: [231]
        )
      spids: [226 230]
    )
    (C {(check_result)} {(SQ <"L K J I H G F E D C B A">)} {(--full-history)})
    (C {(check_result)} {(SQ <"K I H E C B A">)} {(--full-history)} {(--)} {(file)})
    (C {(check_result)} {(SQ <"K I H E C B A">)} {(--full-history)} {(--topo-order)} {(--)} {(file)})
    (C {(check_result)} {(SQ <"K I H E C B A">)} {(--full-history)} {(--date-order)} {(--)} {(file)})
    (C {(check_result)} {(SQ <"I E C B A">)} {(--simplify-merges)} {(--)} {(file)})
    (C {(check_result)} {(SQ <"I B A">)} {(--)} {(file)})
    (C {(check_result)} {(SQ <"I B A">)} {(--topo-order)} {(--)} {(file)})
    (C {(check_result)} {(SQ <H>)} {(--first-parent)} {(--)} {(another-file)})
    (C {(check_result)} {(SQ <"E C B A">)} {(--full-history)} {(E)} {(--)} {(lost)})
    (C {(test_expect_success)} {(SQ <"full history simplification without parent">)} 
      {
        (SQ <"\n"> <"\tprintf \"%s\\n\" E C B A >expect &&\n"> 
          <"\tgit log --pretty=\"$FMT\" --full-history E -- lost |\n"> <"\tunnote >actual &&\n"> <"\tsed -e \"s/^.*\t\\([^ ]*\\) .*/\\1/\" >check <actual &&\n"> 
          <"\ttest_cmp expect check\n">
        )
      }
    )
    (C {(test_expect_success)} {(SQ <"--full-diff is not affected by --parents">)} 
      {
        (SQ <"\n"> <"\tgit log -p --pretty=\"%H\" --full-diff -- file >expected &&\n"> 
          <"\tgit log -p --pretty=\"%H\" --full-diff --parents -- file >actual &&\n"> <"\ttest_cmp expected actual\n">
        )
      }
    )
    (C {(test_done)})
  ]
)