(command.CommandList
  children: [
    (command.ShAssignment
      left: <Id.Lit_VarLike 'test_description='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'test_description='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'git patch-id'>)}
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <.>
      more_env: []
      words: [{<.>} {<'./test-lib.sh'>}]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <setup>)}
        {
          (SQ <'\n'> <'\tas="a a a a a a a a" && # eight a\n'> <'\ttest_write_lines $as >foo &&\n'> 
            <'\ttest_write_lines $as >bar &&\n'> <'\tgit add foo bar &&\n'> <'\tgit commit -a -m initial &&\n'> <'\ttest_write_lines $as b >foo &&\n'> 
            <'\ttest_write_lines $as b >bar &&\n'> <'\tgit commit -a -m first &&\n'> <'\tgit checkout -b same master &&\n'> 
            <'\tgit commit --amend -m same-msg &&\n'> <'\tgit checkout -b notsame master &&\n'> <'\techo c >foo &&\n'> <'\techo c >bar &&\n'> 
            <'\tgit commit --amend -a -m notsame-msg &&\n'> <'\ttest_write_lines bar foo >bar-then-foo &&\n'> <'\ttest_write_lines foo bar >foo-then-bar\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id output is well-formed'>)}
        {
          (SQ <'\n'> <'\tgit log -p -1 | git patch-id >output &&\n'> 
            <'\tgrep "^[a-f0-9]\\{40\\} $(git rev-parse HEAD)$" output\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      name_tok: <calc_patch_id>
      name: calc_patch_id
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              left: <Id.Lit_VarLike 'patch_name='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'patch_name='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'patch_name='> name:patch_name)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number 1))}
                )
              ]
              redirects: []
            )
            (command.Simple
              blame_tok: <shift>
              more_env: []
              words: [{<shift>}]
              redirects: []
              do_fork: T
            )
            (command.AndOr
              children: [
                (command.Pipeline
                  children: [
                    (command.Simple
                      blame_tok: <git>
                      more_env: []
                      words: [{<git>} {<patch-id>} {(DQ ($ Id.VSub_At '@'))}]
                      redirects: []
                      do_fork: T
                    )
                    (command.Simple
                      blame_tok: <sed>
                      more_env: []
                      words: [{<sed>} {(DQ <'s/ .*//'>)}]
                      redirects: [
                        (Redir
                          op: <Id.Redir_Great '>'>
                          loc: (redir_loc.Fd fd:1)
                          arg: {<patch-id_> (DQ ($ Id.VSub_DollarName patch_name))}
                        )
                      ]
                      do_fork: T
                    )
                  ]
                  ops: [<Id.Op_Pipe _>]
                )
                (command.Simple
                  blame_tok: <test_line_count>
                  more_env: []
                  words: [
                    {<test_line_count>}
                    {<-gt>}
                    {<0>}
                    {<patch-id_> (DQ ($ Id.VSub_DollarName patch_name))}
                  ]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <get_top_diff>
      name: get_top_diff
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <git>
              more_env: []
              words: [{<git>} {<log>} {<-p>} {<-1>} {(DQ ($ Id.VSub_At '@'))} {<-O>} {<bar-then-foo>} {<-->}]
              redirects: []
              do_fork: T
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <get_patch_id>
      name: get_patch_id
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Pipeline
              children: [
                (command.Simple
                  blame_tok: <get_top_diff>
                  more_env: []
                  words: [{<get_top_diff>} {(DQ ($ Id.VSub_Number 1))}]
                  redirects: []
                  do_fork: T
                )
                (command.Simple
                  blame_tok: <calc_patch_id>
                  more_env: []
                  words: [{<calc_patch_id>} {(DQ ($ Id.VSub_At '@'))}]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_Pipe _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id detects equality'>)}
        {
          (SQ <'\n'> <'\tget_patch_id master &&\n'> <'\tget_patch_id same &&\n'> 
            <'\ttest_cmp patch-id_master patch-id_same\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id detects inequality'>)}
        {
          (SQ <'\n'> <'\tget_patch_id master &&\n'> <'\tget_patch_id notsame &&\n'> 
            <'\t! test_cmp patch-id_master patch-id_notsame\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id supports git-format-patch output'>)}
        {
          (SQ <'\n'> <'\tget_patch_id master &&\n'> <'\tgit checkout same &&\n'> 
            <'\tgit format-patch -1 --stdout | calc_patch_id same &&\n'> <'\ttest_cmp patch-id_master patch-id_same &&\n'> 
            <'\tset $(git format-patch -1 --stdout | git patch-id) &&\n'> <'\ttest "$2" = $(git rev-parse HEAD)\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'whitespace is irrelevant in footer'>)}
        {
          (SQ <'\n'> <'\tget_patch_id master &&\n'> <'\tgit checkout same &&\n'> 
            <'\tgit format-patch -1 --stdout | sed "s/ \\$//" | calc_patch_id same &&\n'> <'\ttest_cmp patch-id_master patch-id_same\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.ShFunction
      name_tok: <cmp_patch_id>
      name: cmp_patch_id
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.If
              if_kw: <Id.KW_If if>
              arms: [
                (IfArm
                  keyword: <Id.KW_If if>
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Simple
                          blame_tok: <test>
                          more_env: []
                          words: [
                            {<test>}
                            {(DQ ($ Id.VSub_Number 1))}
                            {<Id.Lit_Equals '='>}
                            {(DQ <relevant>)}
                          ]
                          redirects: []
                          do_fork: T
                        )
                      ]
                    )
                  then_kw: <Id.KW_Then then>
                  action: [
                    (command.Pipeline
                      negated: <Id.KW_Bang '!'>
                      children: [
                        (command.Simple
                          blame_tok: <test_cmp>
                          more_env: []
                          words: [
                            {<test_cmp>}
                            {<patch-id_> (DQ ($ Id.VSub_Number 2))}
                            {<patch-id_> (DQ ($ Id.VSub_Number 3))}
                          ]
                          redirects: []
                          do_fork: T
                        )
                      ]
                      ops: []
                    )
                  ]
                  spids: [237 253]
                )
              ]
              else_kw: <Id.KW_Else else>
              else_action: [
                (command.Simple
                  blame_tok: <test_cmp>
                  more_env: []
                  words: [
                    {<test_cmp>}
                    {<patch-id_> (DQ ($ Id.VSub_Number 2))}
                    {<patch-id_> (DQ ($ Id.VSub_Number 3))}
                  ]
                  redirects: []
                  do_fork: T
                )
              ]
              fi_kw: <Id.KW_Fi fi>
              redirects: []
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <test_patch_id_file_order>
      name: test_patch_id_file_order
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.ShAssignment
              left: <Id.Lit_VarLike 'relevant='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'relevant='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'relevant='> name:relevant)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number 1))}
                )
              ]
              redirects: []
            )
            (command.Simple
              blame_tok: <shift>
              more_env: []
              words: [{<shift>}]
              redirects: []
              do_fork: T
            )
            (command.ShAssignment
              left: <Id.Lit_VarLike 'name='>
              pairs: [
                (AssignPair
                  left: <Id.Lit_VarLike 'name='>
                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'name='> name:name)
                  op: assign_op.Equal
                  rhs: {(DQ <order-> (${ Id.VSub_Number 1) <-> ($ Id.VSub_DollarName relevant))}
                )
              ]
              redirects: []
            )
            (command.Simple
              blame_tok: <shift>
              more_env: []
              words: [{<shift>}]
              redirects: []
              do_fork: T
            )
            (command.AndOr
              children: [
                (command.Pipeline
                  children: [
                    (command.Simple
                      blame_tok: <get_top_diff>
                      more_env: []
                      words: [{<get_top_diff>} {(DQ <master>)}]
                      redirects: []
                      do_fork: T
                    )
                    (command.Simple
                      blame_tok: <calc_patch_id>
                      more_env: []
                      words: [
                        {<calc_patch_id>}
                        {(DQ ($ Id.VSub_DollarName name))}
                        {(DQ ($ Id.VSub_At '@'))}
                      ]
                      redirects: []
                      do_fork: T
                    )
                  ]
                  ops: [<Id.Op_Pipe _>]
                )
                (command.Simple
                  blame_tok: <git>
                  more_env: []
                  words: [{<git>} {<checkout>} {<same>}]
                  redirects: []
                  do_fork: T
                )
                (command.Pipeline
                  children: [
                    (command.Simple
                      blame_tok: <git>
                      more_env: []
                      words: [{<git>} {<format-patch>} {<-1>} {<--stdout>} {<-O>} {<foo-then-bar>}]
                      redirects: []
                      do_fork: T
                    )
                    (command.Simple
                      blame_tok: <calc_patch_id>
                      more_env: []
                      words: [
                        {<calc_patch_id>}
                        {(DQ <ordered-> ($ Id.VSub_DollarName name))}
                        {(DQ ($ Id.VSub_At '@'))}
                      ]
                      redirects: []
                      do_fork: T
                    )
                  ]
                  ops: [<Id.Op_Pipe _>]
                )
                (command.Simple
                  blame_tok: <cmp_patch_id>
                  more_env: []
                  words: [
                    {<cmp_patch_id>}
                    {($ Id.VSub_DollarName relevant)}
                    {(DQ ($ Id.VSub_DollarName name))}
                    {(DQ <ordered-> ($ Id.VSub_DollarName name))}
                  ]
                  redirects: []
                  do_fork: T
                )
              ]
              ops: [<Id.Op_DAmp _> <Id.Op_DAmp _> <Id.Op_DAmp _>]
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.ShFunction
      name_tok: <test_patch_id>
      name: test_patch_id
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <test_patch_id_file_order>
              more_env: []
              words: [{<test_patch_id_file_order>} {(DQ ($ Id.VSub_At '@'))}]
              redirects: []
              do_fork: T
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'file order is irrelevant with --stable'>)}
        {(SQ <'\n'> <'\ttest_patch_id_file_order irrelevant --stable --stable\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'file order is relevant with --unstable'>)}
        {(SQ <'\n'> <'\ttest_patch_id_file_order relevant --unstable --unstable\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'default is unstable'>)}
        {(SQ <'\n'> <'\ttest_patch_id relevant default\n'>)}
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patchid.stable = true is stable'>)}
        {
          (SQ <'\n'> <'\ttest_config patchid.stable true &&\n'> 
            <'\ttest_patch_id irrelevant patchid.stable=true\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patchid.stable = false is unstable'>)}
        {
          (SQ <'\n'> <'\ttest_config patchid.stable false &&\n'> 
            <'\ttest_patch_id relevant patchid.stable=false\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--unstable overrides patchid.stable = true'>)}
        {
          (SQ <'\n'> <'\ttest_config patchid.stable true &&\n'> 
            <'\ttest_patch_id relevant patchid.stable=true--unstable --unstable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'--stable overrides patchid.stable = false'>)}
        {
          (SQ <'\n'> <'\ttest_config patchid.stable false &&\n'> 
            <'\ttest_patch_id irrelevant patchid.stable=false--stable --stable\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id supports git-format-patch MIME output'>)}
        {
          (SQ <'\n'> <'\tget_patch_id master &&\n'> <'\tgit checkout same &&\n'> 
            <'\tgit format-patch -1 --attach --stdout | calc_patch_id same &&\n'> <'\ttest_cmp patch-id_master patch-id_same\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id respects config from subdir'>)}
        {
          (SQ <'\n'> <'\ttest_config patchid.stable true &&\n'> <'\tmkdir subdir &&\n'> <'\n'> 
            <'\t# copy these because test_patch_id() looks for them in\n'> <'\t# the current directory\n'> <'\tcp bar-then-foo foo-then-bar subdir &&\n'> <'\n'> <'\t(\n'> 
            <'\t\tcd subdir &&\n'> <'\t\ttest_patch_id irrelevant patchid.stable=true\n'> <'\t)\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<nonl>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git i/a w/a\n'>
                <'index e69de29..2e65efe 100644\n'>
                <'--- i/a\n'>
                <'+++ w/a\n'>
                <'@@ -0,0 +1 @@\n'>
                <'+a\n'>
                <'\\ No newline at end of file\n'>
                <'diff --git i/b w/b\n'>
                <'index e69de29..6178079 100644\n'>
                <'--- i/b\n'>
                <'+++ w/b\n'>
                <'@@ -0,0 +1 @@\n'>
                <'+b\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<withnl>})
        (Redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'diff --git i/a w/a\n'>
                <'index e69de29..7898192 100644\n'>
                <'--- i/a\n'>
                <'+++ w/a\n'>
                <'@@ -0,0 +1 @@\n'>
                <'+a\n'>
                <'diff --git i/b w/b\n'>
                <'index e69de29..6178079 100644\n'>
                <'--- i/b\n'>
                <'+++ w/b\n'>
                <'@@ -0,0 +1 @@\n'>
                <'+b\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_expect_success>
      more_env: []
      words: [
        {<test_expect_success>}
        {(SQ <'patch-id handles no-nl-at-eof markers'>)}
        {
          (SQ <'\n'> <'\tcat nonl | calc_patch_id nonl &&\n'> 
            <'\tcat withnl | calc_patch_id withnl &&\n'> <'\ttest_cmp patch-id_nonl patch-id_withnl\n'>
          )
        }
      ]
      redirects: []
      do_fork: T
    )
    (command.Simple
      blame_tok: <test_done>
      more_env: []
      words: [{<test_done>}]
      redirects: []
      do_fork: T
    )
  ]
)