(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: <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'> ) } ) (SimpleCommand words: [{(write_script)} {(DQ ($ VSub_Name '$HOOK'))}] redirects: [ (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 84 stdin_parts: [('cat >/dev/null\n') ('exit 1\n')] ) ] ) (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: [88 94] ) ) } spids: [86] ) ] spids: [86] ) (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: [129 135] ) ) } spids: [127] ) ] spids: [127] ) (C {(export)} {(COMMIT2)}) (SimpleCommand words: [{(write_script)} {(DQ ($ VSub_Name '$HOOK'))}] redirects: [ (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')] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 175 stdin_parts: [ ('parent1\n') ('repo1\n') ('refs/heads/master ') ($ VSub_Name '$COMMIT2') (' refs/heads/foreign ') ($ VSub_Name '$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'>)} ) (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: [205 211] ) ) } spids: [203] ) ] spids: [203] ) (C {(export)} {(COMMIT3)}) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 235 stdin_parts: [ ('parent1\n') ('repo1\n') ('refs/heads/other ') ($ VSub_Name '$COMMIT3') (' refs/heads/foreign ') ($ VSub_Name '$COMMIT2') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push to default'>)} {(SQ <'\n'> <'\tgit push &&\n'> <'\tdiff expected actual\n'>)} ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 271 stdin_parts: [ ('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') ] ) ] ) (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:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 302 stdin_parts: [ ('parent1\n') ('repo1\n') ('(delete) ') ($ VSub_Name '$_z40') (' refs/heads/prev ') ($ VSub_Name '$COMMIT2') ('\n') ] ) ] ) (C {(test_expect_success)} {(SQ <'push delete'>)} {(SQ <'\n'> <'\tgit push parent1 :prev &&\n'> <'\tdiff expected actual\n'>)} ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expected)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 333 stdin_parts: [ ('repo1\n') ('repo1\n') ('HEAD ') ($ VSub_Name '$COMMIT3') (' refs/heads/other ') ($ VSub_Name '$_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)}) ] )