(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'check pre-push hooks'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:HOOKDIR) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(git)} {(rev-parse)} {(--git-dir)})] ) left_token: <Left_CommandSub '$('> ) (/hooks) ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:HOOK) op: Equal rhs: {(DQ ($ VSub_DollarName '$HOOKDIR') (/pre-push))} ) ] ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_DollarName '$HOOKDIR'))}) (command.SimpleCommand words: [{(write_script)} {(DQ ($ VSub_DollarName '$HOOK'))}] redirects: [ (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 55 stdin_parts: [('cat >/dev/null\n') ('exit 0\n')] ) ] ) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <'\n'> <'\tgit config push.default upstream &&\n'> <'\tgit init --bare repo1 &&\n'> <'\tgit remote add parent1 repo1 &&\n'> <'\ttest_commit one &&\n'> <'\tgit push parent1 HEAD:foreign\n'> ) } ) (command.SimpleCommand words: [{(write_script)} {(DQ ($ VSub_DollarName '$HOOK'))}] redirects: [ (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 84 stdin_parts: [('cat >/dev/null\n') ('exit 1\n')] ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:COMMIT1) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})]) left_token: <Left_CommandSub '$('> ) ) } ) ] ) (C {(export)} {(COMMIT1)}) (C {(test_expect_success)} {(SQ <'push with failing hook'>)} {(SQ <'\n'> <'\ttest_commit two &&\n'> <'\ttest_must_fail git push parent1 HEAD\n'>)} ) (C {(test_expect_success)} {(SQ <'--no-verify bypasses hook'>)} {(SQ <'\n'> <'\tgit push --no-verify parent1 HEAD\n'>)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:COMMIT2) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})]) left_token: <Left_CommandSub '$('> ) ) } ) ] ) (C {(export)} {(COMMIT2)}) (command.SimpleCommand words: [{(write_script)} {(DQ ($ VSub_DollarName '$HOOK'))}] redirects: [ (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(SQ <EOF>)} here_end_span_id: 157 stdin_parts: [('echo "$1" >actual\n') ('echo "$2" >>actual\n') ('cat >>actual\n')] ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 175 stdin_parts: [ ('parent1\n') ('repo1\n') ('refs/heads/master ') ($ VSub_DollarName '$COMMIT2') (' refs/heads/foreign ') ($ VSub_DollarName '$COMMIT1') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push with hook'>)} {(SQ <'\n'> <'\tgit push parent1 master:foreign &&\n'> <'\tdiff expected actual\n'>)} ) (C {(test_expect_success)} {(SQ <'add a branch'>)} {(SQ <'\n'> <'\tgit checkout -b other parent1/foreign &&\n'> <'\ttest_commit three\n'>)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:COMMIT3) op: Equal rhs: { (DQ (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})]) left_token: <Left_CommandSub '$('> ) ) } ) ] ) (C {(export)} {(COMMIT3)}) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 235 stdin_parts: [ ('parent1\n') ('repo1\n') ('refs/heads/other ') ($ VSub_DollarName '$COMMIT3') (' refs/heads/foreign ') ($ VSub_DollarName '$COMMIT2') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push to default'>)} {(SQ <'\n'> <'\tgit push &&\n'> <'\tdiff expected actual\n'>)} ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 271 stdin_parts: [ ('parent1\n') ('repo1\n') ('refs/tags/one ') ($ VSub_DollarName '$COMMIT1') (' refs/tags/tag1 ') ($ VSub_DollarName '$_z40') ('\n') ('HEAD~ ') ($ VSub_DollarName '$COMMIT2') (' refs/heads/prev ') ($ VSub_DollarName '$_z40') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push non-branches'>)} { (SQ <'\n'> <'\tgit push parent1 one:tag1 HEAD~:refs/heads/prev &&\n'> <'\tdiff expected actual\n'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 302 stdin_parts: [ ('parent1\n') ('repo1\n') ('(delete) ') ($ VSub_DollarName '$_z40') (' refs/heads/prev ') ($ VSub_DollarName '$COMMIT2') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push delete'>)} {(SQ <'\n'> <'\tgit push parent1 :prev &&\n'> <'\tdiff expected actual\n'>)} ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 333 stdin_parts: [ ('repo1\n') ('repo1\n') ('HEAD ') ($ VSub_DollarName '$COMMIT3') (' refs/heads/other ') ($ VSub_DollarName '$_z40') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push to URL'>)} {(SQ <'\n'> <'\tgit push repo1 HEAD &&\n'> <'\tdiff expected actual\n'>)} ) (C {(test_expect_success)} {(SQ <'set up many-ref tests'>)} { (SQ <'\n'> <'\t{\n'> <'\t\tnr=1000\n'> <'\t\twhile test $nr -lt 2000\n'> <'\t\tdo\n'> <'\t\t\tnr=$(( $nr + 1 ))\n'> <'\t\t\techo "create refs/heads/b/$nr $COMMIT3"\n'> <'\t\tdone\n'> <'\t} | git update-ref --stdin\n'> ) } ) (C {(test_expect_success)} {(SQ <'sigpipe does not cause pre-push hook failure'>)} { (SQ <'\n'> <'\techo "exit 0" | write_script "$HOOK" &&\n'> <'\tgit push parent1 "refs/heads/b/*:refs/heads/b/*"\n'> ) } ) (C {(test_done)}) ] )