(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {(SQ (Token id:Id.Lit_Chars val:'pushing to a repository using push options' span_id:6))}
          spids: [4]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.ShFunction
      name: mk_repo_pair
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(rm)} {(-rf)} {(workbench)} {(upstream)})
                (C {(test_create_repo)} {(upstream)})
                (C {(test_create_repo)} {(workbench)})
                (command.Subshell
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
                          children: [
                            (C {(cd)} {(upstream)})
                            (C {(git)} {(config)} {(receive.denyCurrentBranch)} {(warn)})
                            (C {(mkdir)} {(-p)} {(.git/hooks)})
                            (command.Simple
                              words: [{(cat)}]
                              redirects: [
                                (redir.Redir
                                  op: (Token id:Id.Redir_Great val:'>' span_id:80)
                                  fd: -1
                                  arg_word: {(.git/hooks/pre-receive)}
                                )
                                (redir.HereDoc
                                  op: (Token id:Id.Redir_DLessDash val:'<<-' span_id:83)
                                  fd: -1
                                  here_begin: {(SQ (Token id:Id.Lit_Chars val:EOF span_id:85))}
                                  here_end_span_id: 100
                                  stdin_parts: [
                                    ('#!/bin/sh\n')
                                    ('if test -n "$GIT_PUSH_OPTION_COUNT"; then\n')
                                    ('i=0\n')
                                    ('>hooks/pre-receive.push_options\n')
                                    ('while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"; do\n')
                                    ('eval "value=\\$GIT_PUSH_OPTION_$i"\n')
                                    ('echo $value >>hooks/pre-receive.push_options\n')
                                    ('i=$((i + 1))\n')
                                    ('done\n')
                                    ('fi\n')
                                  ]
                                )
                              ]
                            )
                            (C {(chmod)} {(u) (Id.Lit_Other '+') (x)} {(.git/hooks/pre-receive)})
                          ]
                        )
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (command.Simple
                              words: [{(cat)}]
                              redirects: [
                                (redir.Redir
                                  op: (Token id:Id.Redir_Great val:'>' span_id:114)
                                  fd: -1
                                  arg_word: {(.git/hooks/post-receive)}
                                )
                                (redir.HereDoc
                                  op: (Token id:Id.Redir_DLessDash val:'<<-' span_id:117)
                                  fd: -1
                                  here_begin: {(SQ (Token id:Id.Lit_Chars val:EOF span_id:119))}
                                  here_end_span_id: 134
                                  stdin_parts: [
                                    ('#!/bin/sh\n')
                                    ('if test -n "$GIT_PUSH_OPTION_COUNT"; then\n')
                                    ('i=0\n')
                                    ('>hooks/post-receive.push_options\n')
                                    ('while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"; do\n')
                                    ('eval "value=\\$GIT_PUSH_OPTION_$i"\n')
                                    ('echo $value >>hooks/post-receive.push_options\n')
                                    ('i=$((i + 1))\n')
                                    ('done\n')
                                    ('fi\n')
                                  ]
                                )
                              ]
                            )
                            (C {(chmod)} {(u) (Id.Lit_Other '+') (x)} {(.git/hooks/post-receive)})
                          ]
                        )
                      ]
                    )
                )
                (command.Subshell
                  command_list: 
                    (command.CommandList
                      children: [
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {(cd)} {(workbench)})
                            (C {(git)} {(remote)} {(add)} {(up)} {(../upstream)})
                          ]
                        )
                      ]
                    )
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_refs
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(test)} {($ Id.VSub_Pound '$#')} {(Id.Lit_Equals '=')} {(2)})
                (command.Simple
                  words: [
                    {(git)}
                    {(-C)}
                    {(upstream)}
                    {(rev-parse)}
                    {(--verify)}
                    {(DQ ($ Id.VSub_Number '$1'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:215)
                      fd: -1
                      arg_word: {(expect)}
                    )
                  ]
                )
                (command.Simple
                  words: [
                    {(git)}
                    {(-C)}
                    {(workbench)}
                    {(rev-parse)}
                    {(--verify)}
                    {(DQ ($ Id.VSub_Number '$2'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:235)
                      fd: -1
                      arg_word: {(actual)}
                    )
                  ]
                )
                (C {(test_cmp)} {(expect)} {(actual)})
              ]
            )
          ]
        )
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'one push option works for a single branch' span_id:253))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:257) 
          (Token id:Id.Lit_Chars val:'\tmk_repo_pair &&\n' span_id:258) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit -C upstream config receive.advertisePushOptions true &&\n'
            span_id: 259
          ) (Token id:Id.Lit_Chars val:'\t(\n' span_id:260) 
          (Token id:Id.Lit_Chars val:'\t\tcd workbench &&\n' span_id:261) (Token id:Id.Lit_Chars val:'\t\ttest_commit one &&\n' span_id:262) 
          (Token id:Id.Lit_Chars val:'\t\tgit push --mirror up &&\n' span_id:263) (Token id:Id.Lit_Chars val:'\t\ttest_commit two &&\n' span_id:264) 
          (Token
            id: Id.Lit_Chars
            val: '\t\tgit push --push-option=asdf up master\n'
            span_id: 265
          ) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:266) 
          (Token id:Id.Lit_Chars val:'\ttest_refs master master &&\n' span_id:267) (Token id:Id.Lit_Chars val:'\techo "asdf" >expect &&\n' span_id:268) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_cmp expect upstream/.git/hooks/pre-receive.push_options &&\n'
            span_id: 269
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_cmp expect upstream/.git/hooks/post-receive.push_options\n'
            span_id: 270
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'push option denied by remote' span_id:277))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:281) 
          (Token id:Id.Lit_Chars val:'\tmk_repo_pair &&\n' span_id:282) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit -C upstream config receive.advertisePushOptions false &&\n'
            span_id: 283
          ) (Token id:Id.Lit_Chars val:'\t(\n' span_id:284) 
          (Token id:Id.Lit_Chars val:'\t\tcd workbench &&\n' span_id:285) (Token id:Id.Lit_Chars val:'\t\ttest_commit one &&\n' span_id:286) 
          (Token id:Id.Lit_Chars val:'\t\tgit push --mirror up &&\n' span_id:287) (Token id:Id.Lit_Chars val:'\t\ttest_commit two &&\n' span_id:288) 
          (Token
            id: Id.Lit_Chars
            val: '\t\ttest_must_fail git push --push-option=asdf up master\n'
            span_id: 289
          ) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:290) 
          (Token id:Id.Lit_Chars val:'\ttest_refs master HEAD@{1}\n' span_id:291)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'two push options work' span_id:298))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:302) 
          (Token id:Id.Lit_Chars val:'\tmk_repo_pair &&\n' span_id:303) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit -C upstream config receive.advertisePushOptions true &&\n'
            span_id: 304
          ) (Token id:Id.Lit_Chars val:'\t(\n' span_id:305) 
          (Token id:Id.Lit_Chars val:'\t\tcd workbench &&\n' span_id:306) (Token id:Id.Lit_Chars val:'\t\ttest_commit one &&\n' span_id:307) 
          (Token id:Id.Lit_Chars val:'\t\tgit push --mirror up &&\n' span_id:308) (Token id:Id.Lit_Chars val:'\t\ttest_commit two &&\n' span_id:309) 
          (Token
            id: Id.Lit_Chars
            val: '\t\tgit push --push-option=asdf --push-option="more structured text" up master\n'
            span_id: 310
          ) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:311) 
          (Token id:Id.Lit_Chars val:'\ttest_refs master master &&\n' span_id:312) (Token id:Id.Lit_Chars val:'\tprintf "asdf\\nmore structured text\\n" >expect &&\n' span_id:313) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_cmp expect upstream/.git/hooks/pre-receive.push_options &&\n'
            span_id: 314
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_cmp expect upstream/.git/hooks/post-receive.push_options\n'
            span_id: 315
          )
        )
      }
    )
    (C {(test_done)})
  ]
)