(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'git remote porcelain-ish'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: setup_repository body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<mkdir>} {(DQ ($ Id.VSub_Number 1))}) (command.Subshell child: (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (C {<cd>} {(DQ ($ Id.VSub_Number 1))}) (C {<git>} {<init>}) (command.Simple words: [] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<file>} ) ] more_env: [] do_fork: F ) (C {<git>} {<add>} {<file>}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ <Initial>)}) (C {<git>} {<checkout>} {<-b>} {<side>}) (command.Simple words: [] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<Id.KW_Elif elif>} ) ] more_env: [] do_fork: F ) (C {<git>} {<add>} {<Id.KW_Elif elif>}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ <Second>)}) (C {<git>} {<checkout>} {<master>}) ] ) redirects: [] ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: tokens_match body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Pipeline children: [ (C {<echo>} {(DQ ($ Id.VSub_Number 1))}) (C {<tr>} {(SQ <' '>)} {(SQ <'\\012'>)}) (C {<sort>}) (command.Simple words: [{<sed>} {<-e>} {(SQ <'/^$/d'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect>} ) ] more_env: [] do_fork: T ) ] negated: F stderr_indices: [] ) (command.Pipeline children: [ (C {<echo>} {(DQ ($ Id.VSub_Number 2))}) (C {<tr>} {(SQ <' '>)} {(SQ <'\\012'>)}) (C {<sort>}) (command.Simple words: [{<sed>} {<-e>} {(SQ <'/^$/d'>)}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] more_env: [] do_fork: T ) ] negated: F stderr_indices: [] ) (C {<test_cmp>} {<expect>} {<actual>}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: check_remote_track body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'actual='> name:actual) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<remote>} {<show>} {(DQ ($ Id.VSub_Number 1))}) (C {<sed>} {<-ne>} {(SQ <'s|^ \\(.*\\) tracked$|\\1|p'>)}) ] negated: F stderr_indices: [] ) right: <Id.Eof_RParen _> ) } spids: [240] ) ] redirects: [] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<shift>}) (C {<tokens_match>} {(DQ ($ Id.VSub_Star '*'))} {(DQ ($ Id.VSub_DollarName actual))}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: check_tracking_branch body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'f='> name:f) op: assign_op.Equal rhs: {(DQ )} spids: [290] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'r='> name:r) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<git>} {<for-each-ref>} {(DQ <'--format=%(refname)'>)}) (C {<sed>} {<-ne>} {(DQ <'s|^refs/remotes/'> ($ Id.VSub_Number 1) <'/||p'>)} ) ] negated: F stderr_indices: [] ) right: <Id.Eof_RParen _> ) } spids: [297] ) ] redirects: [] ) (C {<shift>}) (C {<tokens_match>} {(DQ ($ Id.VSub_Star '*'))} {(DQ ($ Id.VSub_DollarName r))}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\tsetup_repository one &&\n'> <'\tsetup_repository two &&\n'> <'\t(\n'> <'\t\tcd two &&\n'> <'\t\tgit branch another\n'> <'\t) &&\n'> <'\tgit clone one test\n'> ) } ) (C {<test_expect_success>} {(SQ <'add remote whose URL agrees with url.<...>.insteadOf'>)} { (SQ <'\n'> <'\ttest_config url.git@host.com:team/repo.git.insteadOf myremote &&\n'> <'\tgit remote add myremote git@host.com:team/repo.git\n'> ) } ) (C {<test_expect_success>} {<C_LOCALE_OUTPUT>} {(SQ <'remote information for the origin'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\ttokens_match origin "$(git remote)" &&\n'> <'\t\tcheck_remote_track origin master side &&\n'> <'\t\tcheck_tracking_branch origin HEAD master side\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add another remote'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit remote add -f second ../two &&\n'> <'\t\ttokens_match "origin second" "$(git remote)" &&\n'> <'\t\tcheck_tracking_branch second master side another &&\n'> <'\t\tgit for-each-ref "--format=%(refname)" refs/remotes |\n'> <'\t\tsed -e "/^refs\\/remotes\\/origin\\//d" \\\n'> <'\t\t -e "/^refs\\/remotes\\/second\\//d" >actual &&\n'> <'\t\t>expect &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {<C_LOCALE_OUTPUT>} {(SQ <'check remote-tracking'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tcheck_remote_track origin master side &&\n'> <'\t\tcheck_remote_track second master side another\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote forces tracking branches'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tcase $(git config remote.second.fetch) in\n'> <'\t\t+*) true ;;\n'> <'\t\t *) false ;;\n'> <'\t\tesac\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'remove remote'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit symbolic-ref refs/remotes/second/HEAD refs/remotes/second/master &&\n'> <'\t\tgit remote rm second\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {<C_LOCALE_OUTPUT>} {(SQ <'remove remote'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\ttokens_match origin "$(git remote)" &&\n'> <'\t\tcheck_remote_track origin master side &&\n'> <'\t\tgit for-each-ref "--format=%(refname)" refs/remotes |\n'> <'\t\tsed -e "/^refs\\/remotes\\/origin\\//d" >actual &&\n'> <'\t\t>expect &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'remove remote protects local branches'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tcat >expect1 <<-\\EOF &&\n'> <'\t\tNote: A branch outside the refs/remotes/ hierarchy was not removed;\n'> <'\t\tto delete it, use:\n'> <'\t\t git branch -d master\n'> <'\t\tEOF\n'> <'\t\tcat >expect2 <<-\\EOF &&\n'> <'\t\tNote: Some branches outside the refs/remotes/ hierarchy were not removed;\n'> <'\t\tto delete them, use:\n'> <'\t\t git branch -d foobranch\n'> <'\t\t git branch -d master\n'> <'\t\tEOF\n'> <'\t\tgit tag footag &&\n'> <'\t\tgit config --add remote.oops.fetch "+refs/*:refs/*" &&\n'> <'\t\tgit remote remove oops 2>actual1 &&\n'> <'\t\tgit branch foobranch &&\n'> <'\t\tgit config --add remote.oops.fetch "+refs/*:refs/*" &&\n'> <'\t\tgit remote rm oops 2>actual2 &&\n'> <'\t\tgit branch -d foobranch &&\n'> <'\t\tgit tag -d footag &&\n'> <'\t\ttest_i18ncmp expect1 actual1 &&\n'> <'\t\ttest_i18ncmp expect2 actual2\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'remove errors out early when deleting non-existent branch'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\techo "fatal: No such remote: foo" >expect &&\n'> <'\t\ttest_must_fail git remote rm foo 2>actual &&\n'> <'\t\ttest_i18ncmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'rename errors out early when deleting non-existent branch'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\techo "fatal: No such remote: foo" >expect &&\n'> <'\t\ttest_must_fail git remote rename foo bar 2>actual &&\n'> <'\t\ttest_i18ncmp expect actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add existing foreign_vcs remote'>)} { (SQ <'\n'> <'\ttest_config remote.foo.vcs bar &&\n'> <'\techo "fatal: remote foo already exists." >expect &&\n'> <'\ttest_must_fail git remote add foo bar 2>actual &&\n'> <'\ttest_i18ncmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'add existing foreign_vcs remote'>)} { (SQ <'\n'> <'\ttest_config remote.foo.vcs bar &&\n'> <'\ttest_config remote.bar.vcs bar &&\n'> <'\techo "fatal: remote bar already exists." >expect &&\n'> <'\ttest_must_fail git remote rename foo bar 2>actual &&\n'> <'\ttest_i18ncmp expect actual\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 627 stdin_parts: [ <'* remote origin\n'> <' Fetch URL: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/one\n'> <' Push URL: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/one\n'> <' HEAD branch: master\n'> <' Remote branches:\n'> <' master new (next fetch will store in remotes/origin)\n'> <' side tracked\n'> <' Local branches configured for \'git pull\':\n'> <' ahead merges with remote master\n'> <' master merges with remote master\n'> <' octopus merges with remote topic-a\n'> <' and with remote topic-b\n'> <' and with remote topic-c\n'> <' rebase rebases onto remote master\n'> <' Local refs configured for \'git push\':\n'> <' master pushes to master (local out of date)\n'> <' master pushes to upstream (create)\n'> <'* remote two\n'> <' Fetch URL: ../two\n'> <' Push URL: ../three\n'> <' HEAD branch: master\n'> <' Local refs configured for \'git push\':\n'> <' ahead forces to master (fast-forwardable)\n'> <' master pushes to another (up to date)\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <show>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit config --add remote.origin.fetch refs/heads/master:refs/heads/upstream &&\n'> <'\t\tgit fetch &&\n'> <'\t\tgit checkout -b ahead origin/master &&\n'> <'\t\techo 1 >>file &&\n'> <'\t\ttest_tick &&\n'> <'\t\tgit commit -m update file &&\n'> <'\t\tgit checkout master &&\n'> <'\t\tgit branch --track octopus origin/master &&\n'> <'\t\tgit branch --track rebase origin/master &&\n'> <'\t\tgit branch -d -r origin/master &&\n'> <'\t\tgit config --add remote.two.url ../two &&\n'> <'\t\tgit config --add remote.two.pushurl ../three &&\n'> <'\t\tgit config branch.rebase.rebase true &&\n'> <'\t\tgit config branch.octopus.merge "topic-a topic-b topic-c" &&\n'> <'\t\t(\n'> <'\t\t\tcd ../one &&\n'> <'\t\t\techo 1 >file &&\n'> <'\t\t\ttest_tick &&\n'> <'\t\t\tgit commit -m update file\n'> <'\t\t) &&\n'> <'\t\tgit config --add remote.origin.push : &&\n'> <'\t\tgit config --add remote.origin.push refs/heads/master:refs/heads/upstream &&\n'> <'\t\tgit config --add remote.origin.push +refs/tags/lastbackup &&\n'> <'\t\tgit config --add remote.two.push +refs/heads/ahead:refs/heads/master &&\n'> <'\t\tgit config --add remote.two.push refs/heads/master:refs/heads/another &&\n'> <'\t\tgit remote show origin two >output &&\n'> <'\t\tgit branch -d rebase octopus &&\n'> <'\t\ttest_i18ncmp expect output\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 702 stdin_parts: [ <'* remote origin\n'> <' Fetch URL: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/one\n'> <' Push URL: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/one\n'> <' HEAD branch: (not queried)\n'> <' Remote branches: (status not queried)\n'> <' master\n'> <' side\n'> <' Local branches configured for \'git pull\':\n'> <' ahead merges with remote master\n'> <' master merges with remote master\n'> <' Local refs configured for \'git push\' (status not queried):\n'> <' (matching) pushes to (matching)\n'> <' refs/heads/master pushes to refs/heads/upstream\n'> <' refs/tags/lastbackup forces to refs/tags/lastbackup\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'show -n'>)} { (SQ <'\n'> <'\tmv one one.unreachable &&\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit remote show -n origin >output &&\n'> <'\t\tmv ../one.unreachable ../one &&\n'> <'\t\ttest_i18ncmp expect output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <prune>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit branch -m side side2\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit fetch origin &&\n'> <'\t\tgit remote prune origin &&\n'> <'\t\tgit rev-parse refs/remotes/origin/side2 &&\n'> <'\t\ttest_must_fail git rev-parse refs/remotes/origin/side\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'set-head --delete'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit symbolic-ref refs/remotes/origin/HEAD &&\n'> <'\t\tgit remote set-head --delete origin &&\n'> <'\t\ttest_must_fail git symbolic-ref refs/remotes/origin/HEAD\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'set-head --auto'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit remote set-head --auto origin &&\n'> <'\t\techo refs/remotes/origin/master >expect &&\n'> <'\t\tgit symbolic-ref refs/remotes/origin/HEAD >output &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'set-head --auto has no problem w/multiple HEADs'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit fetch two "refs/heads/*:refs/remotes/two/*" &&\n'> <'\t\tgit remote set-head --auto two >output 2>&1 &&\n'> <'\t\techo "two/HEAD set to master" >expect &&\n'> <'\t\ttest_i18ncmp expect output\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 807 stdin_parts: [<'refs/remotes/origin/side2\n'>] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'set-head explicit'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit remote set-head origin side2 &&\n'> <'\t\tgit symbolic-ref refs/remotes/origin/HEAD >output &&\n'> <'\t\tgit remote set-head origin master &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 843 stdin_parts: [ <'Pruning origin\n'> <'URL: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/one\n'> <' * [would prune] origin/side2\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'prune --dry-run'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit branch -m side2 side) &&\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit remote prune --dry-run origin >output &&\n'> <'\t\tgit rev-parse refs/remotes/origin/side2 &&\n'> <'\t\ttest_must_fail git rev-parse refs/remotes/origin/side &&\n'> <'\t(\n'> <'\t\tcd ../one &&\n'> <'\t\tgit branch -m side side2) &&\n'> <'\t\ttest_i18ncmp expect output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add --mirror && prune'>)} { (SQ <'\n'> <'\tmkdir mirror &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tgit init --bare &&\n'> <'\t\tgit remote add --mirror -f origin ../one\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit branch -m side2 side\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tgit rev-parse --verify refs/heads/side2 &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/side &&\n'> <'\t\tgit fetch origin &&\n'> <'\t\tgit remote prune origin &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/side2 &&\n'> <'\t\tgit rev-parse --verify refs/heads/side\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add --mirror=fetch'>)} { (SQ <'\n'> <'\tmkdir mirror-fetch &&\n'> <'\tgit init mirror-fetch/parent &&\n'> <'\t(\n'> <'\t\tcd mirror-fetch/parent &&\n'> <'\t\ttest_commit one\n'> <'\t) &&\n'> <'\tgit init --bare mirror-fetch/child &&\n'> <'\t(\n'> <'\t\tcd mirror-fetch/child &&\n'> <'\t\tgit remote add --mirror=fetch -f parent ../parent\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch mirrors act as mirrors during fetch'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd mirror-fetch/parent &&\n'> <'\t\tgit branch new &&\n'> <'\t\tgit branch -m master renamed\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror-fetch/child &&\n'> <'\t\tgit fetch parent &&\n'> <'\t\tgit rev-parse --verify refs/heads/new &&\n'> <'\t\tgit rev-parse --verify refs/heads/renamed\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch mirrors can prune'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd mirror-fetch/child &&\n'> <'\t\tgit remote prune parent &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/master\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch mirrors do not act as mirrors during push'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd mirror-fetch/parent &&\n'> <'\t\tgit checkout HEAD^0\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror-fetch/child &&\n'> <'\t\tgit branch -m renamed renamed2 &&\n'> <'\t\tgit push parent :\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror-fetch/parent &&\n'> <'\t\tgit rev-parse --verify renamed &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/renamed2\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add fetch mirror with specific branches'>)} { (SQ <'\n'> <'\tgit init --bare mirror-fetch/track &&\n'> <'\t(\n'> <'\t\tcd mirror-fetch/track &&\n'> <'\t\tgit remote add --mirror=fetch -t heads/new parent ../parent\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch mirror respects specific branches'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd mirror-fetch/track &&\n'> <'\t\tgit fetch parent &&\n'> <'\t\tgit rev-parse --verify refs/heads/new &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/renamed\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add --mirror=push'>)} { (SQ <'\n'> <'\tmkdir mirror-push &&\n'> <'\tgit init --bare mirror-push/public &&\n'> <'\tgit init mirror-push/private &&\n'> <'\t(\n'> <'\t\tcd mirror-push/private &&\n'> <'\t\ttest_commit one &&\n'> <'\t\tgit remote add --mirror=push public ../public\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'push mirrors act as mirrors during push'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd mirror-push/private &&\n'> <'\t\tgit branch new &&\n'> <'\t\tgit branch -m master renamed &&\n'> <'\t\tgit push public\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror-push/private &&\n'> <'\t\tgit rev-parse --verify refs/heads/new &&\n'> <'\t\tgit rev-parse --verify refs/heads/renamed &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/master\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'push mirrors do not act as mirrors during fetch'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd mirror-push/public &&\n'> <'\t\tgit branch -m renamed renamed2 &&\n'> <'\t\tgit symbolic-ref HEAD refs/heads/renamed2\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror-push/private &&\n'> <'\t\tgit fetch public &&\n'> <'\t\tgit rev-parse --verify refs/heads/renamed &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/heads/renamed2\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'push mirrors do not allow you to specify refs'>)} { (SQ <'\n'> <'\tgit init mirror-push/track &&\n'> <'\t(\n'> <'\t\tcd mirror-push/track &&\n'> <'\t\ttest_must_fail git remote add --mirror=push -t new public ../public\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'add alt && prune'>)} { (SQ <'\n'> <'\tmkdir alttst &&\n'> <'\t(\n'> <'\t\tcd alttst &&\n'> <'\t\tgit init &&\n'> <'\t\tgit remote add -f origin ../one &&\n'> <'\t\tgit config remote.alt.url ../one &&\n'> <'\t\tgit config remote.alt.fetch "+refs/heads/*:refs/remotes/origin/*"\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit branch -m side side2\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd alttst &&\n'> <'\t\tgit rev-parse --verify refs/remotes/origin/side &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/side2 &&\n'> <'\t\tgit fetch alt &&\n'> <'\t\tgit remote prune alt &&\n'> <'\t\ttest_must_fail git rev-parse --verify refs/remotes/origin/side &&\n'> <'\t\tgit rev-parse --verify refs/remotes/origin/side2\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1139 stdin_parts: [<'some-tag\n'>] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'add with reachable tags (default)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\t>foobar &&\n'> <'\t\tgit add foobar &&\n'> <'\t\tgit commit -m "Foobar" &&\n'> <'\t\tgit tag -a -m "Foobar tag" foobar-tag &&\n'> <'\t\tgit reset --hard HEAD~1 &&\n'> <'\t\tgit tag -a -m "Some tag" some-tag\n'> <'\t) &&\n'> <'\tmkdir add-tags &&\n'> <'\t(\n'> <'\t\tcd add-tags &&\n'> <'\t\tgit init &&\n'> <'\t\tgit remote add -f origin ../one &&\n'> <'\t\tgit tag -l some-tag >../test/output &&\n'> <'\t\tgit tag -l foobar-tag >>../test/output &&\n'> <'\t\ttest_must_fail git config remote.origin.tagopt\n'> <'\t) &&\n'> <'\ttest_cmp test/expect test/output\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1183 stdin_parts: [<'some-tag\n'> <'foobar-tag\n'> <'--tags\n'>] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'add --tags'>)} { (SQ <'\n'> <'\trm -rf add-tags &&\n'> <'\t(\n'> <'\t\tmkdir add-tags &&\n'> <'\t\tcd add-tags &&\n'> <'\t\tgit init &&\n'> <'\t\tgit remote add -f --tags origin ../one &&\n'> <'\t\tgit tag -l some-tag >../test/output &&\n'> <'\t\tgit tag -l foobar-tag >>../test/output &&\n'> <'\t\tgit config remote.origin.tagopt >>../test/output\n'> <'\t) &&\n'> <'\ttest_cmp test/expect test/output\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'test/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1217 stdin_parts: [<'--no-tags\n'>] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'add --no-tags'>)} { (SQ <'\n'> <'\trm -rf add-tags &&\n'> <'\t(\n'> <'\t\tmkdir add-no-tags &&\n'> <'\t\tcd add-no-tags &&\n'> <'\t\tgit init &&\n'> <'\t\tgit remote add -f --no-tags origin ../one &&\n'> <'\t\tgit tag -l some-tag >../test/output &&\n'> <'\t\tgit tag -l foobar-tag >../test/output &&\n'> <'\t\tgit config remote.origin.tagopt >>../test/output\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit tag -d some-tag foobar-tag\n'> <'\t) &&\n'> <'\ttest_cmp test/expect test/output\n'> ) } ) (C {<test_expect_success>} {(SQ <'reject --no-no-tags'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd add-no-tags &&\n'> <'\t\ttest_must_fail git remote add -f --no-no-tags neworigin ../one\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'one/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1274 stdin_parts: [ <' apis/master\n'> <' apis/side\n'> <' drosophila/another\n'> <' drosophila/master\n'> <' drosophila/side\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <update>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit remote add drosophila ../two &&\n'> <'\t\tgit remote add apis ../mirror &&\n'> <'\t\tgit remote update &&\n'> <'\t\tgit branch -r >output &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'one/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1311 stdin_parts: [ <' drosophila/another\n'> <' drosophila/master\n'> <' drosophila/side\n'> <' manduca/master\n'> <' manduca/side\n'> <' megaloprepus/master\n'> <' megaloprepus/side\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'update with arguments'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tfor b in $(git branch -r)\n'> <'\t\tdo\n'> <'\t\tgit branch -r -d $b || exit 1\n'> <'\t\tdone &&\n'> <'\t\tgit remote add manduca ../mirror &&\n'> <'\t\tgit remote add megaloprepus ../mirror &&\n'> <'\t\tgit config remotes.phobaeticus "drosophila megaloprepus" &&\n'> <'\t\tgit config remotes.titanus manduca &&\n'> <'\t\tgit remote update phobaeticus titanus &&\n'> <'\t\tgit branch -r >output &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'update --prune'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit branch -m side2 side3\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd test &&\n'> <'\t\tgit remote update --prune &&\n'> <'\t\t(\n'> <'\t\t\tcd ../one &&\n'> <'\t\t\tgit branch -m side3 side2\n'> <'\t\t) &&\n'> <'\t\tgit rev-parse refs/remotes/origin/side3 &&\n'> <'\t\ttest_must_fail git rev-parse refs/remotes/origin/side2\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'one/expect'>}) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1378 stdin_parts: [ <' apis/master\n'> <' apis/side\n'> <' manduca/master\n'> <' manduca/side\n'> <' megaloprepus/master\n'> <' megaloprepus/side\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'update default'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tfor b in $(git branch -r)\n'> <'\t\tdo\n'> <'\t\tgit branch -r -d $b || exit 1\n'> <'\t\tdone &&\n'> <'\t\tgit config remote.drosophila.skipDefaultUpdate true &&\n'> <'\t\tgit remote update default &&\n'> <'\t\tgit branch -r >output &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'one/expect'>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>} here_end_span_id: 1414 stdin_parts: [ <' drosophila/another\n'> <' drosophila/master\n'> <' drosophila/side\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'update default (overridden, with funny whitespace)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tfor b in $(git branch -r)\n'> <'\t\tdo\n'> <'\t\tgit branch -r -d $b || exit 1\n'> <'\t\tdone &&\n'> <'\t\tgit config remotes.default "$(printf "\\t drosophila \\n")" &&\n'> <'\t\tgit remote update default &&\n'> <'\t\tgit branch -r >output &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'update (with remotes.default defined)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tfor b in $(git branch -r)\n'> <'\t\tdo\n'> <'\t\tgit branch -r -d $b || exit 1\n'> <'\t\tdone &&\n'> <'\t\tgit config remotes.default "drosophila" &&\n'> <'\t\tgit remote update &&\n'> <'\t\tgit branch -r >output &&\n'> <'\t\ttest_cmp expect output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'"remote show" does not show symbolic refs'>)} { (SQ <'\n'> <'\tgit clone one three &&\n'> <'\t(\n'> <'\t\tcd three &&\n'> <'\t\tgit remote show origin >output &&\n'> <'\t\t! grep "^ *HEAD$" < output &&\n'> <'\t\t! grep -i stale < output\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'reject adding remote with an invalid name'>)} {(SQ <'\n'> <'\ttest_must_fail git remote add some:url desired-name\n'>)} ) (C {<test_expect_success>} {(SQ <'rename a remote'>)} { (SQ <'\n'> <'\tgit clone one four &&\n'> <'\t(\n'> <'\t\tcd four &&\n'> <'\t\tgit remote rename origin upstream &&\n'> <'\t\trmdir .git/refs/remotes/origin &&\n'> < '\t\ttest "$(git symbolic-ref refs/remotes/upstream/HEAD)" = "refs/remotes/upstream/master" &&\n' > <'\t\ttest "$(git rev-parse upstream/master)" = "$(git rev-parse master)" &&\n'> < '\t\ttest "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*" &&\n' > <'\t\ttest "$(git config branch.master.remote)" = "upstream"\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'rename does not update a non-default fetch refspec'>)} { (SQ <'\n'> <'\tgit clone one four.one &&\n'> <'\t(\n'> <'\t\tcd four.one &&\n'> <'\t\tgit config remote.origin.fetch +refs/heads/*:refs/heads/origin/* &&\n'> <'\t\tgit remote rename origin upstream &&\n'> < '\t\ttest "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/heads/origin/*" &&\n' > <'\t\tgit rev-parse -q origin/master\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'rename a remote with name part of fetch spec'>)} { (SQ <'\n'> <'\tgit clone one four.two &&\n'> <'\t(\n'> <'\t\tcd four.two &&\n'> <'\t\tgit remote rename origin remote &&\n'> <'\t\tgit remote rename remote upstream &&\n'> < '\t\ttest "$(git config remote.upstream.fetch)" = "+refs/heads/*:refs/remotes/upstream/*"\n' > <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'rename a remote with name prefix of other remote'>)} { (SQ <'\n'> <'\tgit clone one four.three &&\n'> <'\t(\n'> <'\t\tcd four.three &&\n'> <'\t\tgit remote add o git://example.com/repo.git &&\n'> <'\t\tgit remote rename o upstream &&\n'> <'\t\ttest "$(git rev-parse origin/master)" = "$(git rev-parse master)"\n'> <'\t)\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<remotes_origin>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 1591 stdin_parts: [ <'URL: '> (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<pwd>}) right: <Id.Eof_RParen _> ) <'/one\n'> <'Push: refs/heads/master:refs/heads/upstream\n'> <'Push: refs/heads/next:refs/heads/upstream2\n'> <'Pull: refs/heads/master:refs/heads/origin\n'> <'Pull: refs/heads/next:refs/heads/origin2\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<test_expect_success>} {(SQ <'migrate a remote from named file in $GIT_DIR/remotes'>)} { (SQ <'\n'> <'\tgit clone one five &&\n'> <'\torigin_url=$(pwd)/one &&\n'> <'\t(\n'> <'\t\tcd five &&\n'> <'\t\tgit remote remove origin &&\n'> <'\t\tmkdir -p .git/remotes &&\n'> <'\t\tcat ../remotes_origin >.git/remotes/origin &&\n'> <'\t\tgit remote rename origin origin &&\n'> <'\t\ttest_path_is_missing .git/remotes/origin &&\n'> <'\t\ttest "$(git config remote.origin.url)" = "$origin_url" &&\n'> <'\t\tcat >push_expected <<-\\EOF &&\n'> <'\t\trefs/heads/master:refs/heads/upstream\n'> <'\t\trefs/heads/next:refs/heads/upstream2\n'> <'\t\tEOF\n'> <'\t\tcat >fetch_expected <<-\\EOF &&\n'> <'\t\trefs/heads/master:refs/heads/origin\n'> <'\t\trefs/heads/next:refs/heads/origin2\n'> <'\t\tEOF\n'> <'\t\tgit config --get-all remote.origin.push >push_actual &&\n'> <'\t\tgit config --get-all remote.origin.fetch >fetch_actual &&\n'> <'\t\ttest_cmp push_expected push_actual &&\n'> <'\t\ttest_cmp fetch_expected fetch_actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'migrate a remote from named file in $GIT_DIR/branches'>)} { (SQ <'\n'> <'\tgit clone one six &&\n'> <'\torigin_url=$(pwd)/one &&\n'> <'\t(\n'> <'\t\tcd six &&\n'> <'\t\tgit remote rm origin &&\n'> <'\t\techo "$origin_url" >.git/branches/origin &&\n'> <'\t\tgit remote rename origin origin &&\n'> <'\t\ttest_path_is_missing .git/branches/origin &&\n'> <'\t\ttest "$(git config remote.origin.url)" = "$origin_url" &&\n'> <'\t\ttest "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin" &&\n'> <'\t\ttest "$(git config remote.origin.push)" = "HEAD:refs/heads/master"\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'migrate a remote from named file in $GIT_DIR/branches (2)'>)} { (SQ <'\n'> <'\tgit clone one seven &&\n'> <'\t(\n'> <'\t\tcd seven &&\n'> <'\t\tgit remote rm origin &&\n'> <'\t\techo "quux#foom" > .git/branches/origin &&\n'> <'\t\tgit remote rename origin origin &&\n'> <'\t\ttest_path_is_missing .git/branches/origin &&\n'> <'\t\ttest "$(git config remote.origin.url)" = "quux" &&\n'> <'\t\ttest "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"\n'> <'\t\ttest "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote prune to cause a dangling symref'>)} { (SQ <'\n'> <'\tgit clone one eight &&\n'> <'\t(\n'> <'\t\tcd one &&\n'> <'\t\tgit checkout side2 &&\n'> <'\t\tgit branch -D master\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd eight &&\n'> <'\t\tgit remote prune origin\n'> <'\t) >err 2>&1 &&\n'> <'\ttest_i18ngrep "has become dangling" err &&\n'> <'\n'> <'\t: And the dangling symref will not cause other annoying errors &&\n'> <'\t(\n'> <'\t\tcd eight &&\n'> <'\t\tgit branch -a\n'> <'\t) 2>err &&\n'> <'\t! grep "points nowhere" err &&\n'> <'\t(\n'> <'\t\tcd eight &&\n'> <'\t\ttest_must_fail git branch nomore origin\n'> <'\t) 2>err &&\n'> <'\tgrep "dangling symref" err\n'> ) } ) (C {<test_expect_success>} {(SQ <'show empty remote'>)} { (SQ <'\n'> <'\ttest_create_repo empty &&\n'> <'\tgit clone empty empty-clone &&\n'> <'\t(\n'> <'\t\tcd empty-clone &&\n'> <'\t\tgit remote show origin\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-branches requires a remote'>)} { (SQ <'\n'> <'\ttest_must_fail git remote set-branches &&\n'> <'\ttest_must_fail git remote set-branches --add\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-branches'>)} { (SQ <'\n'> <'\techo "+refs/heads/*:refs/remotes/scratch/*" >expect.initial &&\n'> <'\tsort <<-\\EOF >expect.add &&\n'> <'\t+refs/heads/*:refs/remotes/scratch/*\n'> <'\t+refs/heads/other:refs/remotes/scratch/other\n'> <'\tEOF\n'> <'\tsort <<-\\EOF >expect.replace &&\n'> <'\t+refs/heads/maint:refs/remotes/scratch/maint\n'> <'\t+refs/heads/master:refs/remotes/scratch/master\n'> <'\t+refs/heads/next:refs/remotes/scratch/next\n'> <'\tEOF\n'> <'\tsort <<-\\EOF >expect.add-two &&\n'> <'\t+refs/heads/maint:refs/remotes/scratch/maint\n'> <'\t+refs/heads/master:refs/remotes/scratch/master\n'> <'\t+refs/heads/next:refs/remotes/scratch/next\n'> <'\t+refs/heads/pu:refs/remotes/scratch/pu\n'> <'\t+refs/heads/t/topic:refs/remotes/scratch/t/topic\n'> <'\tEOF\n'> <'\tsort <<-\\EOF >expect.setup-ffonly &&\n'> <'\trefs/heads/master:refs/remotes/scratch/master\n'> <'\t+refs/heads/next:refs/remotes/scratch/next\n'> <'\tEOF\n'> <'\tsort <<-\\EOF >expect.respect-ffonly &&\n'> <'\trefs/heads/master:refs/remotes/scratch/master\n'> <'\t+refs/heads/next:refs/remotes/scratch/next\n'> <'\t+refs/heads/pu:refs/remotes/scratch/pu\n'> <'\tEOF\n'> <'\n'> <'\tgit clone .git/ setbranches &&\n'> <'\t(\n'> <'\t\tcd setbranches &&\n'> <'\t\tgit remote rename origin scratch &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >config-result &&\n'> <'\t\tsort <config-result >../actual.initial &&\n'> <'\n'> <'\t\tgit remote set-branches scratch --add other &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >config-result &&\n'> <'\t\tsort <config-result >../actual.add &&\n'> <'\n'> <'\t\tgit remote set-branches scratch maint master next &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >config-result &&\n'> <'\t\tsort <config-result >../actual.replace &&\n'> <'\n'> <'\t\tgit remote set-branches --add scratch pu t/topic &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >config-result &&\n'> <'\t\tsort <config-result >../actual.add-two &&\n'> <'\n'> <'\t\tgit config --unset-all remote.scratch.fetch &&\n'> <'\t\tgit config remote.scratch.fetch \\\n'> <'\t\t\trefs/heads/master:refs/remotes/scratch/master &&\n'> <'\t\tgit config --add remote.scratch.fetch \\\n'> <'\t\t\t+refs/heads/next:refs/remotes/scratch/next &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >config-result &&\n'> <'\t\tsort <config-result >../actual.setup-ffonly &&\n'> <'\n'> <'\t\tgit remote set-branches --add scratch pu &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >config-result &&\n'> <'\t\tsort <config-result >../actual.respect-ffonly\n'> <'\t) &&\n'> <'\ttest_cmp expect.initial actual.initial &&\n'> <'\ttest_cmp expect.add actual.add &&\n'> <'\ttest_cmp expect.replace actual.replace &&\n'> <'\ttest_cmp expect.add-two actual.add-two &&\n'> <'\ttest_cmp expect.setup-ffonly actual.setup-ffonly &&\n'> <'\ttest_cmp expect.respect-ffonly actual.respect-ffonly\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-branches with --mirror'>)} { (SQ <'\n'> <'\techo "+refs/*:refs/*" >expect.initial &&\n'> <'\techo "+refs/heads/master:refs/heads/master" >expect.replace &&\n'> <'\tgit clone --mirror .git/ setbranches-mirror &&\n'> <'\t(\n'> <'\t\tcd setbranches-mirror &&\n'> <'\t\tgit remote rename origin scratch &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >../actual.initial &&\n'> <'\n'> <'\t\tgit remote set-branches scratch heads/master &&\n'> <'\t\tgit config --get-all remote.scratch.fetch >../actual.replace\n'> <'\t) &&\n'> <'\ttest_cmp expect.initial actual.initial &&\n'> <'\ttest_cmp expect.replace actual.replace\n'> ) } ) (C {<test_expect_success>} {(SQ <'new remote'>)} { (SQ <'\n'> <'\tgit remote add someremote foo &&\n'> <'\techo foo >expect &&\n'> <'\tgit config --get-all remote.someremote.url >actual &&\n'> <'\tcmp expect actual\n'> ) } ) (command.ShFunction name: get_url_test body: (BraceGroup left: <Id.Lit_LBrace '{'> 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:{<expect>})] more_env: [] do_fork: T ) (command.Simple words: [{<git>} {<remote>} {<get-url>} {(DQ ($ Id.VSub_At '@'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] more_env: [] do_fork: T ) (C {<test_cmp>} {<expect>} {<actual>}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'get-url on new remote'>)} { (SQ <'\n'> <'\techo foo | get_url_test someremote &&\n'> <'\techo foo | get_url_test --all someremote &&\n'> <'\techo foo | get_url_test --push someremote &&\n'> <'\techo foo | get_url_test --push --all someremote\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url with locked config'>)} { (SQ <'\n'> <'\ttest_when_finished "rm -f .git/config.lock" &&\n'> <'\tgit config --get-all remote.someremote.url >expect &&\n'> <'\t>.git/config.lock &&\n'> <'\ttest_must_fail git remote set-url someremote baz &&\n'> <'\tgit config --get-all remote.someremote.url >actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url bar'>)} { (SQ <'\n'> <'\tgit remote set-url someremote bar &&\n'> <'\techo bar >expect &&\n'> <'\tgit config --get-all remote.someremote.url >actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url baz bar'>)} { (SQ <'\n'> <'\tgit remote set-url someremote baz bar &&\n'> <'\techo baz >expect &&\n'> <'\tgit config --get-all remote.someremote.url >actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url zot bar'>)} { (SQ <'\n'> <'\ttest_must_fail git remote set-url someremote zot bar &&\n'> <'\techo baz >expect &&\n'> <'\tgit config --get-all remote.someremote.url >actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push zot baz'>)} { (SQ <'\n'> <'\ttest_must_fail git remote set-url --push someremote zot baz &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push zot'>)} { (SQ <'\n'> <'\tgit remote set-url --push someremote zot &&\n'> <'\techo zot >expect &&\n'> <'\techo "YYY" >>expect &&\n'> <'\techo baz >>expect &&\n'> <'\tgit config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'get-url with different urls'>)} { (SQ <'\n'> <'\techo baz | get_url_test someremote &&\n'> <'\techo baz | get_url_test --all someremote &&\n'> <'\techo zot | get_url_test --push someremote &&\n'> <'\techo zot | get_url_test --push --all someremote\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push qux zot'>)} { (SQ <'\n'> <'\tgit remote set-url --push someremote qux zot &&\n'> <'\techo qux >expect &&\n'> <'\techo "YYY" >>expect &&\n'> <'\techo baz >>expect &&\n'> <'\tgit config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push foo qu+x'>)} { (SQ <'\n'> <'\tgit remote set-url --push someremote foo qu+x &&\n'> <'\techo foo >expect &&\n'> <'\techo "YYY" >>expect &&\n'> <'\techo baz >>expect &&\n'> <'\tgit config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push --add aaa'>)} { (SQ <'\n'> <'\tgit remote set-url --push --add someremote aaa &&\n'> <'\techo foo >expect &&\n'> <'\techo aaa >>expect &&\n'> <'\techo "YYY" >>expect &&\n'> <'\techo baz >>expect &&\n'> <'\tgit config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'get-url on multi push remote'>)} { (SQ <'\n'> <'\techo foo | get_url_test --push someremote &&\n'> <'\tget_url_test --push --all someremote <<-\\EOF\n'> <'\tfoo\n'> <'\taaa\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push bar aaa'>)} { (SQ <'\n'> <'\tgit remote set-url --push someremote bar aaa &&\n'> <'\techo foo >expect &&\n'> <'\techo bar >>expect &&\n'> <'\techo "YYY" >>expect &&\n'> <'\techo baz >>expect &&\n'> <'\tgit config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push --delete bar'>)} { (SQ <'\n'> <'\tgit remote set-url --push --delete someremote bar &&\n'> <'\techo foo >expect &&\n'> <'\techo "YYY" >>expect &&\n'> <'\techo baz >>expect &&\n'> <'\tgit config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --push --delete foo'>)} { (SQ <'\n'> <'\tgit remote set-url --push --delete someremote foo &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --add bbb'>)} { (SQ <'\n'> <'\tgit remote set-url --add someremote bbb &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\techo bbb >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'get-url on multi fetch remote'>)} { (SQ <'\n'> <'\techo baz | get_url_test someremote &&\n'> <'\tget_url_test --all someremote <<-\\EOF\n'> <'\tbaz\n'> <'\tbbb\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --delete .*'>)} { (SQ <'\n'> <'\ttest_must_fail git remote set-url --delete someremote .\\* &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\techo bbb >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --delete bbb'>)} { (SQ <'\n'> <'\tgit remote set-url --delete someremote bbb &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --delete baz'>)} { (SQ <'\n'> <'\ttest_must_fail git remote set-url --delete someremote baz &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --add ccc'>)} { (SQ <'\n'> <'\tgit remote set-url --add someremote ccc &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo baz >>expect &&\n'> <'\techo ccc >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'remote set-url --delete baz'>)} { (SQ <'\n'> <'\tgit remote set-url --delete someremote baz &&\n'> <'\techo "YYY" >expect &&\n'> <'\techo ccc >>expect &&\n'> <'\ttest_must_fail git config --get-all remote.someremote.pushurl >actual &&\n'> <'\techo "YYY" >>actual &&\n'> <'\tgit config --get-all remote.someremote.url >>actual &&\n'> <'\tcmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'extra args: setup'>)} { (SQ <'\n'> <'\t# add a dummy origin so that this does not trigger failure\n'> <'\tgit remote add origin .\n'> ) } ) (command.ShFunction name: test_extra_arg body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (C {<test_expect_success>} {(DQ <'extra args: '> ($ Id.VSub_Star '*'))} { (DQ <'\n'> <'\t\ttest_must_fail git remote '> ($ Id.VSub_Star '*') <' bogus_extra_arg 2>actual &&\n'> <'\t\ttest_i18ngrep \'^usage:\' actual\n'> <'\t'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_extra_arg>} {<add>} {<nick>} {<url>}) (C {<test_extra_arg>} {<rename>} {<origin>} {<newname>}) (C {<test_extra_arg>} {<remove>} {<origin>}) (C {<test_extra_arg>} {<set-head>} {<origin>} {<master>}) (C {<test_extra_arg>} {<get-url>} {<origin>} {<newurl>}) (C {<test_extra_arg>} {<set-url>} {<origin>} {<newurl>} {<oldurl>}) (C {<test_expect_success>} {(SQ <'add remote matching the "insteadOf" URL'>)} { (SQ <'\n'> <'\tgit config url.xyz@example.com.insteadOf backup &&\n'> <'\tgit remote add backup xyz@example.com\n'> ) } ) (C {<test_done>}) ] )