(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'check pre-push hooks'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:HOOKDIR) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(--git-dir)})]) left_token: <Left_CommandSub '$('> spids: [19 25] ) (/hooks) ) } spids: [17] ) ] spids: [17] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:HOOK) op: Equal rhs: {(DQ ($ VSub_Name '$HOOKDIR') (/pre-push))} spids: [29] ) ] spids: [29] ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name '$HOOKDIR'))}) (SimpleCommand words: [{(write_script)} {(DQ ($ VSub_Name '$HOOK'))}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ('cat >/dev/null\n') ('exit 0\n'))} do_expansion: True here_end: EOF was_filled: True spids: [49] ) ] ) (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'> ) } ) (SimpleCommand words: [{(write_script)} {(DQ ($ VSub_Name '$HOOK'))}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ('cat >/dev/null\n') ('exit 1\n'))} do_expansion: True here_end: EOF was_filled: True spids: [76] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMMIT1) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})]) left_token: <Left_CommandSub '$('> spids: [84 90] ) ) } spids: [82] ) ] spids: [82] ) (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'>)} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMMIT2) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})]) left_token: <Left_CommandSub '$('> spids: [125 131] ) ) } spids: [123] ) ] spids: [123] ) (C {(export)} {(COMMIT2)}) (SimpleCommand words: [{(write_script)} {(DQ ($ VSub_Name '$HOOK'))}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: {('echo "$1" >actual\n') ('echo "$2" >>actual\n') ('cat >>actual\n')} do_expansion: False here_end: EOF was_filled: True spids: [145] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[153]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ('parent1\n') ('repo1\n') ('refs/heads/master ') ($ VSub_Name '$COMMIT2') (' refs/heads/foreign ') ($ VSub_Name '$COMMIT1') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [156] ) ] ) (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'>)} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMMIT3) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(git)} {(rev-parse)} {(HEAD)})]) left_token: <Left_CommandSub '$('> spids: [195 201] ) ) } spids: [193] ) ] spids: [193] ) (C {(export)} {(COMMIT3)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[211]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ('parent1\n') ('repo1\n') ('refs/heads/other ') ($ VSub_Name '$COMMIT3') (' refs/heads/foreign ') ($ VSub_Name '$COMMIT2') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [214] ) ] ) (C {(test_expect_success)} {(SQ <'push to default'>)} {(SQ <'\n'> <'\tgit push &&\n'> <'\tdiff expected actual\n'>)} ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[240]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ('parent1\n') ('repo1\n') ('refs/tags/one ') ($ VSub_Name '$COMMIT1') (' refs/tags/tag1 ') ($ VSub_Name '$_z40') ('\n') ('HEAD~ ') ($ VSub_Name '$COMMIT2') (' refs/heads/prev ') ($ VSub_Name '$_z40') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [243] ) ] ) (C {(test_expect_success)} {(SQ <'push non-branches'>)} { (SQ <'\n'> <'\tgit push parent1 one:tag1 HEAD~:refs/heads/prev &&\n'> <'\tdiff expected actual\n'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[274]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ('parent1\n') ('repo1\n') ('(delete) ') ($ VSub_Name '$_z40') (' refs/heads/prev ') ($ VSub_Name '$COMMIT2') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [277] ) ] ) (C {(test_expect_success)} {(SQ <'push delete'>)} {(SQ <'\n'> <'\tgit push parent1 :prev &&\n'> <'\tdiff expected actual\n'>)} ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[303]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ('repo1\n') ('repo1\n') ('HEAD ') ($ VSub_Name '$COMMIT3') (' refs/heads/other ') ($ VSub_Name '$_z40') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [306] ) ] ) (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)}) ] )