(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ <'git merge\n'> <'\n'> 
                <'Testing octopus merge when reducing parents to independent branches.'>
              )
            }
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\techo c0 > c0.c &&\n'> <'\tgit add c0.c &&\n'> <'\tgit commit -m c0 &&\n'> 
          <'\tgit tag c0 &&\n'> <'\techo c1 > c1.c &&\n'> <'\tgit add c1.c &&\n'> <'\tgit commit -m c1 &&\n'> <'\tgit tag c1 &&\n'> 
          <'\tgit reset --hard c0 &&\n'> <'\techo c2 > c2.c &&\n'> <'\tgit add c2.c &&\n'> <'\tgit commit -m c2 &&\n'> <'\tgit tag c2 &&\n'> 
          <'\tgit reset --hard c0 &&\n'> <'\techo c3 > c3.c &&\n'> <'\tgit add c3.c &&\n'> <'\tgit commit -m c3 &&\n'> <'\tgit tag c3 &&\n'> 
          <'\tgit reset --hard c0 &&\n'> <'\techo c4 > c4.c &&\n'> <'\tgit add c4.c &&\n'> <'\tgit commit -m c4 &&\n'> <'\tgit tag c4 &&\n'> 
          <'\techo c5 > c5.c &&\n'> <'\tgit add c5.c &&\n'> <'\tgit commit -m c5 &&\n'> <'\tgit tag c5\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge c1 with c2, c3, c4, c5'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit merge c2 c3 c4 c5 &&\n'> 
          <'\ttest "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&\n'> <'\ttest "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&\n'> 
          <'\ttest "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&\n'> <'\ttest "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&\n'> 
          <'\ttest "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&\n'> <'\tgit diff --exit-code &&\n'> <'\ttest -f c0.c &&\n'> <'\ttest -f c1.c &&\n'> <'\ttest -f c2.c &&\n'> 
          <'\ttest -f c3.c &&\n'> <'\ttest -f c4.c &&\n'> <'\ttest -f c5.c &&\n'> <'\tgit show --format=%s -s >actual &&\n'> 
          <'\t! grep c1 actual &&\n'> <'\tgrep c2 actual &&\n'> <'\tgrep c3 actual &&\n'> <'\t! grep c4 actual &&\n'> <'\tgrep c5 actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'pull c2, c3, c4, c5 into c1'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard c1 &&\n'> <'\tgit pull . c2 c3 c4 c5 &&\n'> 
          <'\ttest "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&\n'> <'\ttest "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&\n'> 
          <'\ttest "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&\n'> <'\ttest "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&\n'> 
          <'\ttest "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&\n'> <'\tgit diff --exit-code &&\n'> <'\ttest -f c0.c &&\n'> <'\ttest -f c1.c &&\n'> <'\ttest -f c2.c &&\n'> 
          <'\ttest -f c3.c &&\n'> <'\ttest -f c4.c &&\n'> <'\ttest -f c5.c &&\n'> <'\tgit show --format=%s -s >actual &&\n'> 
          <'\t! grep c1 actual &&\n'> <'\tgrep c2 actual &&\n'> <'\tgrep c3 actual &&\n'> <'\t! grep c4 actual &&\n'> <'\tgrep c5 actual\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tfor i in A B C D E\n'> <'\tdo\n'> <'\t\techo $i > $i.c &&\n'> 
          <'\t\tgit add $i.c &&\n'> <'\t\tgit commit -m $i &&\n'> <'\t\tgit tag $i\n'> <'\tdone &&\n'> <'\tgit reset --hard A &&\n'> 
          <'\tfor i in F G H I\n'> <'\tdo\n'> <'\t\techo $i > $i.c &&\n'> <'\t\tgit add $i.c &&\n'> <'\t\tgit commit -m $i &&\n'> 
          <'\t\tgit tag $i\n'> <'\tdone\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge E and I'>)} 
      {(SQ <'\n'> <'\tgit reset --hard A &&\n'> <'\tgit merge E I\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'verify merge result'>)} 
      {
        (SQ <'\n'> <'\ttest $(git rev-parse HEAD^1) = $(git rev-parse E) &&\n'> 
          <'\ttest $(git rev-parse HEAD^2) = $(git rev-parse I)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'add conflicts'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard E &&\n'> <'\techo foo > file.c &&\n'> <'\tgit add file.c &&\n'> 
          <'\tgit commit -m E2 &&\n'> <'\tgit tag E2 &&\n'> <'\tgit reset --hard I &&\n'> <'\techo bar >file.c &&\n'> 
          <'\tgit add file.c &&\n'> <'\tgit commit -m I2 &&\n'> <'\tgit tag I2\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'merge E2 and I2, causing a conflict and resolve it'>)} 
      {
        (SQ <'\n'> <'\tgit reset --hard A &&\n'> <'\ttest_must_fail git merge E2 I2 &&\n'> 
          <'\techo baz > file.c &&\n'> <'\tgit add file.c &&\n'> <'\tgit commit -m "resolve conflict"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'verify merge result'>)} 
      {
        (SQ <'\n'> <'\ttest $(git rev-parse HEAD^1) = $(git rev-parse E2) &&\n'> 
          <'\ttest $(git rev-parse HEAD^2) = $(git rev-parse I2)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'fast-forward to redundant refs'>)} 
      {(SQ <'\n'> <'\tgit reset --hard c0 &&\n'> <'\tgit merge c4 c5\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'verify merge result'>)} 
      {(SQ <'\n'> <'\ttest $(git rev-parse HEAD) = $(git rev-parse c5)\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'merge up-to-date redundant refs'>)} 
      {(SQ <'\n'> <'\tgit reset --hard c5 &&\n'> <'\tgit merge c0 c4\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'verify merge result'>)} 
      {(SQ <'\n'> <'\ttest $(git rev-parse HEAD) = $(git rev-parse c5)\n'>)}
    )
    (C {<test_done>})
  ]
)