(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[12]) op: Equal rhs: {(SQ <'send-pack --stdin tests'>)} spids: [12] ) ] spids: [12] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: create_ref body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:tree spids:[30]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(git)} {(write-tree)})]) left_token: <Left_CommandSub '$('> spids: [31 35] ) } spids: [30] ) ] spids: [30] ) (C {(test_tick)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:commit spids:[45]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(echo)} {(DQ ($ VSub_Number '$1'))}) (C {(git)} {(commit-tree)} {($ VSub_Name '$tree')}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [46 60] ) } spids: [45] ) ] spids: [45] ) (C {(git)} {(update-ref)} {(DQ ($ VSub_Number '$1'))} {($ VSub_Name '$commit')}) ] ) ] spids: [27] ) spids: [22 26] ) (command.FuncDef name: clear_remote body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(rm)} {(-rf)} {(remote.git)}) (C {(git)} {(init)} {(--bare)} {(remote.git)}) ] ) ] spids: [83] ) spids: [78 82] ) (command.FuncDef name: verify_push body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [{(git)} {(rev-parse)} {(DQ ($ VSub_Number '$1'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})] ) (command.SimpleCommand words: [ {(git)} {(--git-dir) (Lit_Other '=') (remote.git)} {(rev-parse)} { (DQ (word_part.BracedVarSub token: <VSub_Number 2> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonHyphen arg_word: {($ VSub_Number '$1')} ) spids: [137 141] ) ) } ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (C {(test_cmp)} {(expect)} {(actual)}) ] ) ] spids: [111] ) spids: [106 110] ) (C {(test_expect_success)} {(SQ <'setup refs'>)} { (SQ <'\n'> <'\tcat >refs <<-\\EOF &&\n'> <'\trefs/heads/A\n'> <'\trefs/heads/C\n'> <'\trefs/tags/D\n'> <'\trefs/heads/B\n'> <'\trefs/tags/E\n'> <'\tEOF\n'> <'\tfor i in $(cat refs); do\n'> <'\t\tcreate_ref $i || return 1\n'> <'\tdone\n'> ) } ) (C {(test_expect_success)} {(SQ <'refs on cmdline'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\tgit send-pack remote.git $(cat refs) &&\n'> <'\tfor i in $(cat refs); do\n'> <'\t\tverify_push $i || return 1\n'> <'\tdone\n'> ) } ) (C {(test_expect_success)} {(SQ <'refs over stdin'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\tgit send-pack remote.git --stdin <refs &&\n'> <'\tfor i in $(cat refs); do\n'> <'\t\tverify_push $i || return 1\n'> <'\tdone\n'> ) } ) (C {(test_expect_success)} {(SQ <'stdin lines are full refspecs'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\techo "A:other" >input &&\n'> <'\tgit send-pack remote.git --stdin <input &&\n'> <'\tverify_push refs/heads/A refs/heads/other\n'> ) } ) (C {(test_expect_success)} {(SQ <'stdin mixed with cmdline'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\techo A >input &&\n'> <'\tgit send-pack remote.git --stdin B <input &&\n'> <'\tverify_push A &&\n'> <'\tverify_push B\n'> ) } ) (C {(test_expect_success)} {(SQ <'cmdline refs written in order'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\ttest_must_fail git send-pack remote.git A:foo B:foo &&\n'> <'\tverify_push A foo\n'> ) } ) (C {(test_expect_success)} {(SQ <'--stdin refs come after cmdline'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\techo A:foo >input &&\n'> <'\ttest_must_fail git send-pack remote.git --stdin B:foo <input &&\n'> <'\tverify_push B foo\n'> ) } ) (C {(test_expect_success)} {(SQ <'refspecs and --mirror do not mix (cmdline)'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\ttest_must_fail git send-pack remote.git --mirror $(cat refs)\n'> ) } ) (C {(test_expect_success)} {(SQ <'refspecs and --mirror do not mix (stdin)'>)} { (SQ <'\n'> <'\tclear_remote &&\n'> <'\ttest_must_fail git send-pack remote.git --mirror --stdin <refs\n'> ) } ) (C {(test_done)}) ] )