(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'pushing to a repository using push options'>)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: mk_repo_pair
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(rm)} {(-rf)} {(workbench)} {(upstream)})
                (AndOr
                  children: [
                    (C {(test_create_repo)} {(upstream)})
                    (AndOr
                      children: [
                        (C {(test_create_repo)} {(workbench)})
                        (AndOr
                          children: [
                            (Subshell
                              child: 
                                (CommandList
                                  children: [
                                    (AndOr
                                      children: [
                                        (C {(cd)} {(upstream)})
                                        (AndOr
                                          children: [
                                            (C {(git)} {(config)} {(receive.denyCurrentBranch)} {(warn)})
                                            (AndOr
                                              children: [
                                                (C {(mkdir)} {(-p)} {(.git/hooks)})
                                                (AndOr
                                                  children: [
                                                    (SimpleCommand
                                                      words: [{(cat)}]
                                                      redirects: [
                                                        (Redir
                                                          op_id: Redir_Great
                                                          fd: -1
                                                          arg_word: {(.git/hooks/pre-receive)}
                                                          spids: [80]
                                                        )
                                                        (HereDoc
                                                          op_id: Redir_DLessDash
                                                          fd: -1
                                                          body: 
                                                            {('#!/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')
                                                            }
                                                          do_expansion: False
                                                          here_end: EOF
                                                          was_filled: True
                                                          spids: [83]
                                                        )
                                                      ]
                                                    )
                                                    (C {(chmod)} {(u) (Lit_Other '+') (x)} 
                                                      {(.git/hooks/pre-receive)}
                                                    )
                                                  ]
                                                  op_id: Op_DAmp
                                                )
                                              ]
                                              op_id: Op_DAmp
                                            )
                                          ]
                                          op_id: Op_DAmp
                                        )
                                      ]
                                      op_id: Op_DAmp
                                    )
                                    (AndOr
                                      children: [
                                        (SimpleCommand
                                          words: [{(cat)}]
                                          redirects: [
                                            (Redir
                                              op_id: Redir_Great
                                              fd: -1
                                              arg_word: {(.git/hooks/post-receive)}
                                              spids: [103]
                                            )
                                            (HereDoc
                                              op_id: Redir_DLessDash
                                              fd: -1
                                              body: 
                                                {('#!/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')
                                                }
                                              do_expansion: False
                                              here_end: EOF
                                              was_filled: True
                                              spids: [106]
                                            )
                                          ]
                                        )
                                        (C {(chmod)} {(u) (Lit_Other '+') (x)} 
                                          {(.git/hooks/post-receive)}
                                        )
                                      ]
                                      op_id: Op_DAmp
                                    )
                                  ]
                                )
                              spids: [48 123]
                            )
                            (Subshell
                              child: 
                                (AndOr
                                  children: [
                                    (C {(cd)} {(workbench)})
                                    (C {(git)} {(remote)} {(add)} {(up)} {(../upstream)})
                                  ]
                                  op_id: Op_DAmp
                                )
                              spids: [128 149]
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [20]
        )
      spids: [15 19]
    )
    (FuncDef
      name: test_refs
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(test)} {($ VSub_Pound '$#')} {(Lit_Other '=')} {(2)})
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [
                        {(git)}
                        {(-C)}
                        {(upstream)}
                        {(rev-parse)}
                        {(--verify)}
                        {(DQ ($ VSub_Number '$1'))}
                      ]
                      redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect)} spids:[193])]
                    )
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [
                            {(git)}
                            {(-C)}
                            {(workbench)}
                            {(rev-parse)}
                            {(--verify)}
                            {(DQ ($ VSub_Number '$2'))}
                          ]
                          redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[213])]
                        )
                        (C {(test_cmp)} {(expect)} {(actual)})
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [165]
        )
      spids: [160 164]
    )
    (C {(test_expect_success)} {(SQ <'one push option works for a single branch'>)} 
      {
        (SQ <'\n'> <'\tmk_repo_pair &&\n'> 
          <'\tgit -C upstream config receive.advertisePushOptions true &&\n'> <'\t(\n'> <'\t\tcd workbench &&\n'> <'\t\ttest_commit one &&\n'> <'\t\tgit push --mirror up &&\n'> 
          <'\t\ttest_commit two &&\n'> <'\t\tgit push --push-option=asdf up master\n'> <'\t) &&\n'> <'\ttest_refs master master &&\n'> 
          <'\techo "asdf" >expect &&\n'> <'\ttest_cmp expect upstream/.git/hooks/pre-receive.push_options &&\n'> 
          <'\ttest_cmp expect upstream/.git/hooks/post-receive.push_options\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'push option denied by remote'>)} 
      {
        (SQ <'\n'> <'\tmk_repo_pair &&\n'> 
          <'\tgit -C upstream config receive.advertisePushOptions false &&\n'> <'\t(\n'> <'\t\tcd workbench &&\n'> <'\t\ttest_commit one &&\n'> <'\t\tgit push --mirror up &&\n'> 
          <'\t\ttest_commit two &&\n'> <'\t\ttest_must_fail git push --push-option=asdf up master\n'> <'\t) &&\n'> 
          <'\ttest_refs master HEAD@{1}\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'two push options work'>)} 
      {
        (SQ <'\n'> <'\tmk_repo_pair &&\n'> 
          <'\tgit -C upstream config receive.advertisePushOptions true &&\n'> <'\t(\n'> <'\t\tcd workbench &&\n'> <'\t\ttest_commit one &&\n'> <'\t\tgit push --mirror up &&\n'> 
          <'\t\ttest_commit two &&\n'> <'\t\tgit push --push-option=asdf --push-option="more structured text" up master\n'> <'\t) &&\n'> 
          <'\ttest_refs master master &&\n'> <'\tprintf "asdf\\nmore structured text\\n" >expect &&\n'> 
          <'\ttest_cmp expect upstream/.git/hooks/pre-receive.push_options &&\n'> <'\ttest_cmp expect upstream/.git/hooks/post-receive.push_options\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)