(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'fetch handles conflicting refspecs correctly'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:D) op: assign_op.Equal rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<pwd>}))} spids: [15] ) ] ) (command.ShFunction name: setup_repository body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<git>} {<init>} {(DQ ($ Id.VSub_Number '$1'))}) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ ($ Id.VSub_Number '$1'))}) (C {<git>} {<config>} {<remote.origin.url>} {(DQ ($ Id.VSub_DollarName '$D'))}) (C {<shift>}) (command.ForEach iter_name: refspec iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [ (C {<git>} {<config>} {<--add>} {<remote.origin.fetch>} {(DQ ($ Id.VSub_DollarName '$refspec'))} ) ] ) ) ] ) ) ] ) ] ) ) (command.ShFunction name: verify_stderr body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<cat>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})] do_fork: T ) (command.Pipeline children: [ (command.Simple words: [{<test_i18ngrep>} {<-E>} {(SQ <'^(fatal|warning):'>)}] redirects: [(redir op:<Id.Redir_Less '<'> loc:(redir_loc.Fd fd:0) arg:{<error>})] do_fork: T ) (command.Simple words: [{<grep>} {<-v>} {(SQ <'hung up'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] do_fork: T ) (C {<sort>}) ] negated: F ) (C {<test_i18ncmp>} {<expected>} {<actual>}) ] ) ] ) ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\tgit commit --allow-empty -m "Initial" &&\n'> <'\tgit branch branch1 &&\n'> <'\tgit tag tag1 &&\n'> <'\tgit commit --allow-empty -m "First" &&\n'> <'\tgit branch branch2 &&\n'> <'\tgit tag tag2\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch with no conflict'>)} { (SQ <'\n'> <'\tsetup_repository ok "+refs/heads/*:refs/remotes/origin/*" && (\n'> <'\t\tcd ok &&\n'> <'\t\tgit fetch origin\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch conflict: config vs. config'>)} { (SQ <'\n'> <'\tsetup_repository ccc \\\n'> <'\t\t"+refs/heads/branch1:refs/remotes/origin/branch1" \\\n'> <'\t\t"+refs/heads/branch2:refs/remotes/origin/branch1" && (\n'> <'\t\tcd ccc &&\n'> <'\t\ttest_must_fail git fetch origin 2>error &&\n'> <'\t\tverify_stderr <<-\\EOF\n'> < '\t\tfatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1\n' > <'\t\tEOF\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch duplicate: config vs. config'>)} { (SQ <'\n'> <'\tsetup_repository dcc \\\n'> <'\t\t"+refs/heads/*:refs/remotes/origin/*" \\\n'> <'\t\t"+refs/heads/branch1:refs/remotes/origin/branch1" && (\n'> <'\t\tcd dcc &&\n'> <'\t\tgit fetch origin\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch conflict: arg overrides config'>)} { (SQ <'\n'> <'\tsetup_repository aoc \\\n'> <'\t\t"+refs/heads/*:refs/remotes/origin/*" && (\n'> <'\t\tcd aoc &&\n'> <'\t\tgit fetch origin refs/heads/branch2:refs/remotes/origin/branch1\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch conflict: arg vs. arg'>)} { (SQ <'\n'> <'\tsetup_repository caa && (\n'> <'\t\tcd caa &&\n'> <'\t\ttest_must_fail git fetch origin \\\n'> <'\t\t\trefs/heads/*:refs/remotes/origin/* \\\n'> <'\t\t\trefs/heads/branch2:refs/remotes/origin/branch1 2>error &&\n'> <'\t\tverify_stderr <<-\\EOF\n'> < '\t\tfatal: Cannot fetch both refs/heads/branch1 and refs/heads/branch2 to refs/remotes/origin/branch1\n' > <'\t\tEOF\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch conflict: criss-cross args'>)} { (SQ <'\n'> <'\tsetup_repository xaa \\\n'> <'\t\t"+refs/heads/*:refs/remotes/origin/*" && (\n'> <'\t\tcd xaa &&\n'> <'\t\tgit fetch origin \\\n'> <'\t\t\trefs/heads/branch1:refs/remotes/origin/branch2 \\\n'> <'\t\t\trefs/heads/branch2:refs/remotes/origin/branch1 2>error &&\n'> <'\t\tverify_stderr <<-\\EOF\n'> < '\t\twarning: refs/remotes/origin/branch1 usually tracks refs/heads/branch1, not refs/heads/branch2\n' > < '\t\twarning: refs/remotes/origin/branch2 usually tracks refs/heads/branch2, not refs/heads/branch1\n' > <'\t\tEOF\n'> <'\t)\n'> ) } ) (C {<test_done>}) ] )