(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'test subject preservation with format-patch | am'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: make_patches
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:type)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [21]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:subject)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$2')}
                  spids: [25]
                )
              ]
            )
            (C {<test_expect_success>} 
              {(DQ <'create patches with '> ($ Id.VSub_DollarName '$type') <' subject'>)} 
              {
                (SQ <'\n'> <'\t\tgit reset --hard baseline &&\n'> <'\t\techo $type >file &&\n'> 
                  <'\t\tgit commit -a -m "$subject" &&\n'> <'\t\tgit format-patch -1 --stdout >$type.patch &&\n'> 
                  <'\t\tgit format-patch -1 --stdout -k >$type-k.patch\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: check_subject
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {<git>} {<reset>} {<--hard>} {<baseline>})
                (C {<git>} {<am>} {($ Id.VSub_Number '$2')} {($ Id.VSub_Number '$1') <.patch>})
                (command.Simple
                  words: [
                    {<git>}
                    {<log>}
                    {<-1>}
                    {<--pretty> <Id.Lit_Equals '='> <format> <Id.Lit_Colon ':'> <Id.Lit_Other '%'> <B>}
                  ]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})]
                  do_fork: T
                )
                (C {<test_cmp>} {<expect>} {<actual>})
              ]
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'setup baseline commit'>)} 
      {(SQ <'\n'> <'\ttest_commit baseline file\n'>)}
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:SHORT_SUBJECT)
          op: assign_op.Equal
          rhs: {(SQ <'short subject'>)}
          spids: [120]
        )
      ]
    )
    (C {<make_patches>} {<short>} {(DQ ($ Id.VSub_DollarName '$SHORT_SUBJECT'))})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LONG_SUBJECT1)
          op: assign_op.Equal
          rhs: {(SQ <'this is a long subject that is virtually guaranteed'>)}
          spids: [134]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LONG_SUBJECT2)
          op: assign_op.Equal
          rhs: {(SQ <'to require wrapping via format-patch if it is all'>)}
          spids: [139]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LONG_SUBJECT3)
          op: assign_op.Equal
          rhs: {(SQ <'going to appear on a single line'>)}
          spids: [144]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:LONG_SUBJECT)
          op: assign_op.Equal
          rhs: 
            {
              (DQ ($ Id.VSub_DollarName '$LONG_SUBJECT1') <' '> ($ Id.VSub_DollarName '$LONG_SUBJECT2') 
                <' '> ($ Id.VSub_DollarName '$LONG_SUBJECT3')
              )
            }
          spids: [149]
        )
      ]
    )
    (C {<make_patches>} {<long>} {(DQ ($ Id.VSub_DollarName '$LONG_SUBJECT'))})
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:MULTILINE_SUBJECT)
          op: assign_op.Equal
          rhs: 
            {
              (DQ ($ Id.VSub_DollarName '$LONG_SUBJECT1') <'\n'> 
                ($ Id.VSub_DollarName '$LONG_SUBJECT2') <'\n'> ($ Id.VSub_DollarName '$LONG_SUBJECT3')
              )
            }
          spids: [167]
        )
      ]
    )
    (C {<make_patches>} {<multiline>} {(DQ ($ Id.VSub_DollarName '$MULTILINE_SUBJECT'))})
    (command.Simple
      words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$SHORT_SUBJECT'))}]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'short subject preserved (format-patch | am)'>)} 
      {(SQ <'\n'> <'\tcheck_subject short\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'short subject preserved (format-patch -k | am)'>)} 
      {(SQ <'\n'> <'\tcheck_subject short-k\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'short subject preserved (format-patch -k | am -k)'>)} 
      {(SQ <'\n'> <'\tcheck_subject short-k -k\n'>)}
    )
    (command.Simple
      words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$LONG_SUBJECT'))}]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'long subject preserved (format-patch | am)'>)} 
      {(SQ <'\n'> <'\tcheck_subject long\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'long subject preserved (format-patch -k | am)'>)} 
      {(SQ <'\n'> <'\tcheck_subject long-k\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'long subject preserved (format-patch -k | am -k)'>)} 
      {(SQ <'\n'> <'\tcheck_subject long-k -k\n'>)}
    )
    (command.Simple
      words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$LONG_SUBJECT'))}]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'multiline subject unwrapped (format-patch | am)'>)} 
      {(SQ <'\n'> <'\tcheck_subject multiline\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'multiline subject unwrapped (format-patch -k | am)'>)} 
      {(SQ <'\n'> <'\tcheck_subject multiline-k\n'>)}
    )
    (command.Simple
      words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$MULTILINE_SUBJECT'))}]
      redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'multiline subject preserved (format-patch -k | am -k)'>)} 
      {(SQ <'\n'> <'\tcheck_subject multiline-k -k\n'>)}
    )
    (C {<test_done>})
  ]
)