(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Merge base and parent list computation.\n'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<./test-lib.sh>})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:M)
          op: assign_op.Equal
          rhs: {<1130000000>}
          spids: [24]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:Z)
          op: assign_op.Equal
          rhs: {<Id.Lit_Other '+'> <0000>}
          spids: [27]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_COMMITTER_EMAIL)
          op: assign_op.Equal
          rhs: {<git> <Id.Lit_Splice '@comm'> <.iter.xz>}
          spids: [32]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_COMMITTER_NAME)
          op: assign_op.Equal
          rhs: {(SQ <'C O Mmiter'>)}
          spids: [37]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_AUTHOR_NAME)
          op: assign_op.Equal
          rhs: {(SQ <'A U Thor'>)}
          spids: [42]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:GIT_AUTHOR_EMAIL)
          op: assign_op.Equal
          rhs: {<git> <Id.Lit_Splice '@au'> <.thor.xz>}
          spids: [47]
        )
      ]
    )
    (C {<export>} {<GIT_COMMITTER_EMAIL>} {<GIT_COMMITTER_NAME>} {<GIT_AUTHOR_NAME>} {<GIT_AUTHOR_EMAIL>})
    (command.ShFunction
      name: doit
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
              ]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:OFFSET)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number '$1')}
                      spids: [71]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:NAME)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_Number '$2')}
                      spids: [77]
                    )
                  ]
                )
                (C {<shift>} {<2>})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:PARENTS)
                      op: assign_op.Equal
                      rhs: (word.Empty)
                      spids: [91]
                    )
                  ]
                )
                (command.ForEach
                  iter_name: P
                  do_arg_iter: T
                  body: 
                    (command.DoGroup
                      children: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:PARENTS)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (DQ (${ Id.VSub_Name PARENTS) <'-p '> ($ Id.VSub_DollarName '$P') 
                                    <' '>
                                  )
                                }
                              spids: [104]
                            )
                          ]
                        )
                      ]
                    )
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:GIT_COMMITTER_DATE)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (DQ 
                            (word_part.ArithSub
                              anode: 
                                (arith_expr.Binary
                                  op_id: Id.Arith_Plus
                                  left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$M')})
                                  right: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$OFFSET')})
                                )
                            ) <' '> ($ Id.VSub_DollarName '$Z')
                          )
                        }
                      spids: [121]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:GIT_AUTHOR_DATE)
                      op: assign_op.Equal
                      rhs: {($ Id.VSub_DollarName '$GIT_COMMITTER_DATE')}
                      spids: [138]
                    )
                  ]
                )
                (C {<export>} {<GIT_COMMITTER_DATE>} {<GIT_AUTHOR_DATE>})
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:commit)
                      op: assign_op.Equal
                      rhs: 
                        {
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            command_list: 
                              (command.CommandList
                                children: [
                                  (command.Pipeline
                                    children: [
                                      (C {<echo>} {($ Id.VSub_DollarName '$NAME')})
                                      (C {<git>} {<commit-tree>} {($ Id.VSub_DollarName '$T')} 
                                        {($ Id.VSub_DollarName '$PARENTS')}
                                      )
                                    ]
                                    negated: F
                                  )
                                ]
                              )
                          )
                        }
                      spids: [154]
                    )
                  ]
                )
                (command.Simple
                  words: [{<echo>} {($ Id.VSub_DollarName '$commit')}]
                  redirects: [
                    (redir.Redir
                      op: <Id.Redir_Great '>'>
                      fd: -1
                      arg_word: {<.git/refs/tags/> ($ Id.VSub_DollarName '$NAME')}
                    )
                  ]
                )
                (C {<echo>} {($ Id.VSub_DollarName '$commit')})
              ]
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <setup>)} {(SQ <'\n'> <'\tT=$(git mktree </dev/null)\n'>)})
    (C {<test_expect_success>} {(SQ <'set up G and H'>)} 
      {
        (SQ <'\n'> <'\t# E---D---C---B---A\n'> <'\t# \\"-_         \\   \\\n'> 
          <'\t#  \\  `---------G   \\\n'> <'\t#   \\                \\\n'> <'\t#    F----------------H\n'> <'\tE=$(doit 5 E) &&\n'> 
          <'\tD=$(doit 4 D $E) &&\n'> <'\tF=$(doit 6 F $E) &&\n'> <'\tC=$(doit 3 C $D) &&\n'> <'\tB=$(doit 2 B $C) &&\n'> 
          <'\tA=$(doit 1 A $B) &&\n'> <'\tG=$(doit 7 G $B $E) &&\n'> <'\tH=$(doit 8 H $A $F)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge-base G H'>)} 
      {
        (SQ <'\n'> <'\tgit name-rev $B >expected &&\n'> <'\n'> <'\tMB=$(git merge-base G H) &&\n'> 
          <'\tgit name-rev "$MB" >actual.single &&\n'> <'\n'> <'\tMB=$(git merge-base --all G H) &&\n'> <'\tgit name-rev "$MB" >actual.all &&\n'> <'\n'> 
          <'\tMB=$(git show-branch --merge-base G H) &&\n'> <'\tgit name-rev "$MB" >actual.sb &&\n'> <'\n'> <'\ttest_cmp expected actual.single &&\n'> 
          <'\ttest_cmp expected actual.all &&\n'> <'\ttest_cmp expected actual.sb\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge-base/show-branch --independent'>)} 
      {
        (SQ <'\n'> <'\tgit name-rev "$H" >expected1 &&\n'> <'\tgit name-rev "$H" "$G" >expected2 &&\n'> 
          <'\n'> <'\tparents=$(git merge-base --independent H) &&\n'> <'\tgit name-rev $parents >actual1.mb &&\n'> 
          <'\tparents=$(git merge-base --independent A H G) &&\n'> <'\tgit name-rev $parents >actual2.mb &&\n'> <'\n'> 
          <'\tparents=$(git show-branch --independent H) &&\n'> <'\tgit name-rev $parents >actual1.sb &&\n'> <'\tparents=$(git show-branch --independent A H G) &&\n'> 
          <'\tgit name-rev $parents >actual2.sb &&\n'> <'\n'> <'\ttest_cmp expected1 actual1.mb &&\n'> <'\ttest_cmp expected2 actual2.mb &&\n'> 
          <'\ttest_cmp expected1 actual1.sb &&\n'> <'\ttest_cmp expected2 actual2.sb\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'unsynchronized clocks'>)} 
      {
        (SQ <'\n'> <'\t# This test is to demonstrate that relying on timestamps in a distributed\n'> 
          <'\t# SCM to provide a _consistent_ partial ordering of commits leads to\n'> <'\t# insanity.\n'> <'\t#\n'> <'\t#               Relative\n'> <'\t# Structure     timestamps\n'> 
          <'\t#\n'> <'\t#   PL  PR        +4  +4\n'> <'\t#  /  \\/  \\      /  \\/  \\\n'> 
          <'\t# L2  C2  R2    +3  -1  +3\n'> <'\t# |   |   |     |   |   |\n'> <'\t# L1  C1  R1    +2  -2  +2\n'> <'\t# |   |   |     |   |   |\n'> 
          <'\t# L0  C0  R0    +1  -3  +1\n'> <'\t#   \\ |  /        \\ |  /\n'> <'\t#     S             0\n'> <'\t#\n'> 
          <'\t# The left and right chains of commits can be of any length and complexity as\n'> <'\t# long as all of the timestamps are greater than that of S.\n'> <'\n'> <'\tS=$(doit  0 S) &&\n'> 
          <'\n'> <'\tC0=$(doit -3 C0 $S) &&\n'> <'\tC1=$(doit -2 C1 $C0) &&\n'> <'\tC2=$(doit -1 C2 $C1) &&\n'> <'\n'> 
          <'\tL0=$(doit  1 L0 $S) &&\n'> <'\tL1=$(doit  2 L1 $L0) &&\n'> <'\tL2=$(doit  3 L2 $L1) &&\n'> <'\n'> <'\tR0=$(doit  1 R0 $S) &&\n'> 
          <'\tR1=$(doit  2 R1 $R0) &&\n'> <'\tR2=$(doit  3 R2 $R1) &&\n'> <'\n'> <'\tPL=$(doit  4 PL $L2 $C2) &&\n'> 
          <'\tPR=$(doit  4 PR $C2 $R2) &&\n'> <'\n'> <'\tgit name-rev $C2 >expected &&\n'> <'\n'> <'\tMB=$(git merge-base PL PR) &&\n'> 
          <'\tgit name-rev "$MB" >actual.single &&\n'> <'\n'> <'\tMB=$(git merge-base --all PL PR) &&\n'> <'\tgit name-rev "$MB" >actual.all &&\n'> <'\n'> 
          <'\ttest_cmp expected actual.single &&\n'> <'\ttest_cmp expected actual.all\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--independent with unsynchronized clocks'>)} 
      {
        (SQ <'\n'> <'\tIB=$(doit 0 IB) &&\n'> <'\tI1=$(doit -10 I1 $IB) &&\n'> 
          <'\tI2=$(doit  -9 I2 $I1) &&\n'> <'\tI3=$(doit  -8 I3 $I2) &&\n'> <'\tI4=$(doit  -7 I4 $I3) &&\n'> <'\tI5=$(doit  -6 I5 $I4) &&\n'> 
          <'\tI6=$(doit  -5 I6 $I5) &&\n'> <'\tI7=$(doit  -4 I7 $I6) &&\n'> <'\tI8=$(doit  -3 I8 $I7) &&\n'> <'\tIH=$(doit  -2 IH $I8) &&\n'> 
          <'\n'> <'\techo $IH >expected &&\n'> <'\tgit merge-base --independent IB IH >actual &&\n'> 
          <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge-base for octopus-step (setup)'>)} 
      {
        (SQ <'\n'> <'\t# Another set to demonstrate base between one commit and a merge\n'> 
          <'\t# in the documentation.\n'> <'\t#\n'> <'\t# * C (MMC) * B (MMB) * A  (MMA)\n'> <'\t# * o       * o       * o\n'> 
          <'\t# * o       * o       * o\n'> <'\t# * o       * o       * o\n'> <'\t# * o       | _______/\n'> <'\t# |         |/\n'> 
          <'\t# |         * 1 (MM1)\n'> <'\t# | _______/\n'> <'\t# |/\n'> <'\t# * root (MMR)\n'> <'\n'> <'\ttest_commit MMR &&\n'> 
          <'\ttest_commit MM1 &&\n'> <'\ttest_commit MM-o &&\n'> <'\ttest_commit MM-p &&\n'> <'\ttest_commit MM-q &&\n'> 
          <'\ttest_commit MMA &&\n'> <'\tgit checkout MM1 &&\n'> <'\ttest_commit MM-r &&\n'> <'\ttest_commit MM-s &&\n'> 
          <'\ttest_commit MM-t &&\n'> <'\ttest_commit MMB &&\n'> <'\tgit checkout MMR &&\n'> <'\ttest_commit MM-u &&\n'> 
          <'\ttest_commit MM-v &&\n'> <'\ttest_commit MM-w &&\n'> <'\ttest_commit MM-x &&\n'> <'\ttest_commit MMC\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge-base A B C'>)} 
      {
        (SQ <'\n'> <'\tgit rev-parse --verify MM1 >expected &&\n'> 
          <'\tgit rev-parse --verify MMR >expected.sb &&\n'> <'\n'> <'\tgit merge-base --all MMA MMB MMC >actual &&\n'> 
          <'\tgit merge-base --all --octopus MMA MMB MMC >actual.common &&\n'> <'\tgit show-branch --merge-base MMA MMB MMC >actual.sb &&\n'> <'\n'> 
          <'\ttest_cmp expected actual &&\n'> <'\ttest_cmp expected.sb actual.common &&\n'> <'\ttest_cmp expected.sb actual.sb\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'criss-cross merge-base for octopus-step'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard MMR &&\n'> <'\ttest_commit CC1 &&\n'> 
          <'\tgit reset --hard E &&\n'> <'\ttest_commit CC2 &&\n'> <'\ttest_tick &&\n'> 
          <'\t# E is a root commit unrelated to MMR root on which CC1 is based\n'> <'\tgit merge -s ours --allow-unrelated-histories CC1 &&\n'> <'\ttest_commit CC-o &&\n'> 
          <'\ttest_commit CCB &&\n'> <'\tgit reset --hard CC1 &&\n'> 
          <'\t# E is a root commit unrelated to MMR root on which CC1 is based\n'> <'\tgit merge -s ours --allow-unrelated-histories CC2 &&\n'> <'\ttest_commit CCA &&\n'> <'\n'> 
          <'\tgit rev-parse CC1 CC2 >expected &&\n'> <'\tgit merge-base --all CCB CCA^^ CCA^^2 >actual &&\n'> <'\n'> 
          <'\tsort expected >expected.sorted &&\n'> <'\tsort actual >actual.sorted &&\n'> <'\ttest_cmp expected.sorted actual.sorted\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'using reflog to find the fork point'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout -b base $E &&\n'> <'\n'> <'\t(\n'> 
          <'\t\tfor count in 1 2 3\n'> <'\t\tdo\n'> <'\t\t\tgit commit --allow-empty -m "Base commit #$count" &&\n'> 
          <'\t\t\tgit rev-parse HEAD >expect$count &&\n'> <'\t\t\tgit checkout -B derived &&\n'> <'\t\t\tgit commit --allow-empty -m "Derived #$count" &&\n'> 
          <'\t\t\tgit rev-parse HEAD >derived$count &&\n'> <'\t\t\tgit checkout -B base $E || exit 1\n'> <'\t\tdone\n'> <'\n'> <'\t\tfor count in 1 2 3\n'> 
          <'\t\tdo\n'> <'\t\t\tgit merge-base --fork-point base $(cat derived$count) >actual &&\n'> 
          <'\t\t\ttest_cmp expect$count actual || exit 1\n'> <'\t\tdone\n'> <'\n'> <'\t) &&\n'> <'\t# check that we correctly default to HEAD\n'> 
          <'\tgit checkout derived &&\n'> <'\tgit merge-base --fork-point base >actual &&\n'> <'\ttest_cmp expect3 actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--fork-point works with empty reflog'>)} 
      {
        (SQ <'\n'> <'\tgit -c core.logallrefupdates=false branch no-reflog base &&\n'> 
          <'\tgit merge-base --fork-point no-reflog derived &&\n'> <'\ttest_cmp expect3 actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge-base --octopus --all for complex tree'>)} 
      {
        (SQ <'\n'> <'\t# Best common ancestor for JE, JAA and JDD is JC\n'> <'\t#             JE\n'> 
          <'\t#            / |\n'> <'\t#           /  |\n'> <'\t#          /   |\n'> <'\t#  JAA    /    |\n'> <'\t#   |\\   /     |\n'> 
          <'\t#   | \\  | JDD |\n'> <'\t#   |  \\ |/ |  |\n'> <'\t#   |   JC JD  |\n'> <'\t#   |    | /|  |\n'> <'\t#   |    |/ |  |\n'> 
          <'\t#  JA    |  |  |\n'> <'\t#   |\\  /|  |  |\n'> <'\t#   X JB |  X  X\n'> <'\t#   \\  \\ | /   /\n'> <'\t#    \\__\\|/___/\n'> 
          <'\t#        J\n'> <'\ttest_commit J &&\n'> <'\ttest_commit JB &&\n'> <'\tgit reset --hard J &&\n'> 
          <'\ttest_commit JC &&\n'> <'\tgit reset --hard J &&\n'> <'\ttest_commit JTEMP1 &&\n'> <'\ttest_merge JA JB &&\n'> 
          <'\ttest_merge JAA JC &&\n'> <'\tgit reset --hard J &&\n'> <'\ttest_commit JTEMP2 &&\n'> <'\ttest_merge JD JB &&\n'> 
          <'\ttest_merge JDD JC &&\n'> <'\tgit reset --hard J &&\n'> <'\ttest_commit JTEMP3 &&\n'> <'\ttest_merge JE JC &&\n'> 
          <'\tgit rev-parse JC >expected &&\n'> <'\tgit merge-base --all --octopus JAA JDD JE >actual &&\n'> <'\ttest_cmp expected actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)