(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git remote group handling'>)} spids: [4] ) ] ) (C {<.>} {<./test-lib.sh>}) (command.ShFunction name: mark body: (command.BraceGroup children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number '$1'))}] redirects: [(redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{<mark>})] ) ] ) ) (command.ShFunction name: update_repo body: (command.BraceGroup children: [ (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {($ Id.VSub_Number '$1')}) (command.Simple words: [{<echo>} {<content>}] redirects: [(redir.Redir op:<Id.Redir_DGreat '>>'> fd:-1 arg_word:{<file>})] ) (C {<git>} {<add>} {<file>}) (C {<git>} {<commit>} {<-F>} {<../mark>}) ] ) ] ) ) ] ) ) (command.ShFunction name: update_repos body: (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<update_repo>} {<one>} {($ Id.VSub_Number '$1')}) (C {<update_repo>} {<two>} {($ Id.VSub_Number '$1')}) ] ) ] ) ) (command.ShFunction name: repo_fetched body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {<test>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children: [ (C {<git>} {<log>} {<-1>} {<--pretty> <Id.Lit_Equals '='> <format> <Id.Lit_Other ':'> <Id.Lit_Other '%'> <s> } {($ Id.VSub_Number '$1')} {<-->} ) ] ) ) ) } {<Id.Lit_Equals '='>} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children:[(C {<cat>} {<mark>})]) ) ) } ) terminator: <Id.Op_Semi _> ) ] action: [ (command.Simple words: [{<echo>} {(DQ <'repo was fetched: '> ($ Id.VSub_Number '$1'))}] redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})] ) (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<0>} ) ] spids: [111 147] ) ] ) (command.Simple words: [{<echo>} {(DQ <'repo was not fetched: '> ($ Id.VSub_Number '$1'))}] redirects: [(redir.Redir op:<Id.Redir_GreatAnd '>&'> fd:-1 arg_word:{<2>})] ) (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) ] ) ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\tmkdir one && (cd one && git init) &&\n'> <'\tmkdir two && (cd two && git init) &&\n'> <'\tgit remote add -m master one one &&\n'> <'\tgit remote add -m master two two\n'> ) } ) (C {<test_expect_success>} {(SQ <'no group updates all'>)} { (SQ <'\n'> <'\tmark update-all &&\n'> <'\tupdate_repos &&\n'> <'\tgit remote update &&\n'> <'\trepo_fetched one &&\n'> <'\trepo_fetched two\n'> ) } ) (C {<test_expect_success>} {(SQ <'nonexistent group produces error'>)} { (SQ <'\n'> <'\tmark nonexistent &&\n'> <'\tupdate_repos &&\n'> <'\ttest_must_fail git remote update nonexistent &&\n'> <'\t! repo_fetched one &&\n'> <'\t! repo_fetched two\n'> ) } ) (C {<test_expect_success>} {(SQ <'updating group updates all members (remote update)'>)} { (SQ <'\n'> <'\tmark group-all &&\n'> <'\tupdate_repos &&\n'> <'\tgit config --add remotes.all one &&\n'> <'\tgit config --add remotes.all two &&\n'> <'\tgit remote update all &&\n'> <'\trepo_fetched one &&\n'> <'\trepo_fetched two\n'> ) } ) (C {<test_expect_success>} {(SQ <'updating group updates all members (fetch)'>)} { (SQ <'\n'> <'\tmark fetch-group-all &&\n'> <'\tupdate_repos &&\n'> <'\tgit fetch all &&\n'> <'\trepo_fetched one &&\n'> <'\trepo_fetched two\n'> ) } ) (C {<test_expect_success>} {(SQ <'updating group does not update non-members (remote update)'>)} { (SQ <'\n'> <'\tmark group-some &&\n'> <'\tupdate_repos &&\n'> <'\tgit config --add remotes.some one &&\n'> <'\tgit remote update some &&\n'> <'\trepo_fetched one &&\n'> <'\t! repo_fetched two\n'> ) } ) (C {<test_expect_success>} {(SQ <'updating group does not update non-members (fetch)'>)} { (SQ <'\n'> <'\tmark fetch-group-some &&\n'> <'\tupdate_repos &&\n'> <'\tgit config --add remotes.some one &&\n'> <'\tgit remote update some &&\n'> <'\trepo_fetched one &&\n'> <'\t! repo_fetched two\n'> ) } ) (C {<test_expect_success>} {(SQ <'updating remote name updates that remote'>)} { (SQ <'\n'> <'\tmark remote-name &&\n'> <'\tupdate_repos &&\n'> <'\tgit remote update one &&\n'> <'\trepo_fetched one &&\n'> <'\t! repo_fetched two\n'> ) } ) (C {<test_done>}) ] )