(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'pushing to a repository using push options'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: mk_repo_pair body: (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 child: (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 op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'.git/hooks/pre-receive'>} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(SQ <EOF>)} 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'> ] ) ) ] do_fork: T ) (C {<chmod>} {<u> <Id.Lit_Other '+'> <x>} {<'.git/hooks/pre-receive'>}) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'.git/hooks/post-receive'>} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {(SQ <EOF>)} 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'> ] ) ) ] do_fork: T ) (C {<chmod>} {<u> <Id.Lit_Other '+'> <x>} {<'.git/hooks/post-receive'>}) ] ) ] ) ) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<cd>} {<workbench>}) (C {<git>} {<remote>} {<add>} {<up>} {<'../upstream'>}) ] ) ) ] ) ] ) ) (command.ShFunction name: test_refs body: (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 op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] do_fork: T ) (command.Simple words: [ {<git>} {<-C>} {<workbench>} {<rev-parse>} {<--verify>} {(DQ ($ Id.VSub_Number '$2'))} ] 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 <'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>}) ] )