(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Test wacky input to git config'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: setup body: (BraceGroup children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<printf>} {(DQ <'[section]'> <Id.Lit_BadBackslash '\\'> <n>)}) (C {<printf>} {(DQ <' key = foo'>)}) ] ) redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'.git/config'>})] ) ] ) ) (command.ShFunction name: check body: (BraceGroup children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number '$2'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})] do_fork: T ) (command.Simple words: [{<git>} {<config>} {<--get>} {(DQ ($ Id.VSub_Number '$1'))}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>}) (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>}) ] do_fork: T ) (C {<test_cmp>} {<actual>} {<expected>}) ] ) ) (command.ShFunction name: check_regex body: (BraceGroup children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number '$3'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})] do_fork: T ) (command.Simple words: [ {<git>} {<config>} {<--get>} {(DQ ($ Id.VSub_Number '$1'))} {(DQ ($ Id.VSub_Number '$2'))} ] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>}) (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>}) ] do_fork: T ) (C {<test_cmp>} {<actual>} {<expected>}) ] ) ) (C {<test_expect_success>} {(SQ <'modify same key'>)} { (SQ <'\n'> <'\tsetup &&\n'> <'\tgit config section.key bar &&\n'> <'\tcheck section.key bar\n'>) } ) (C {<test_expect_success>} {(SQ <'add key in same section'>)} { (SQ <'\n'> <'\tsetup &&\n'> <'\tgit config section.other bar &&\n'> <'\tcheck section.key foo &&\n'> <'\tcheck section.other bar\n'> ) } ) (C {<test_expect_success>} {(SQ <'add key in different section'>)} { (SQ <'\n'> <'\tsetup &&\n'> <'\tgit config section2.key bar &&\n'> <'\tcheck section.key foo &&\n'> <'\tcheck section2.key bar\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SECTION) op: assign_op.Equal rhs: { (DQ <test.q> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <s> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <'sq\'sp e.key'> ) } spids: [195] ) ] ) (C {<test_expect_success>} {(SQ <'make sure git config escapes section names properly'>)} {(SQ <'\n'> <'\tgit config "$SECTION" bar &&\n'> <'\tcheck "$SECTION" bar\n'>)} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:LONG_VALUE) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} {(DQ <'x%01021dx a'>)} {<7>}) ) } spids: [217] ) ] ) (C {<test_expect_success>} {(SQ <'do not crash on special long config line'>)} { (SQ <'\n'> <'\tsetup &&\n'> <'\tgit config section.key "$LONG_VALUE" &&\n'> <'\tcheck section.key "$LONG_VALUE"\n'> ) } ) (command.ShFunction name: setup_many body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<setup>}) (command.Simple words: [{<echo>}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<'.git/config'>} ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<5to1>} ) (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'>) <OF>} here_end_span_id: 298 stdin_parts: [ <' key = foo\n'> <' key = foo\n'> <' key = foo\n'> <' key = foo\n'> <' key = foo\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<cat>} {<5to1>} {<5to1>} {<5to1>} {<5to1>} {<5to1>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<5to2>})] do_fork: T ) (command.Simple words: [{<cat>} {<5to2>} {<5to2>} {<5to2>} {<5to2>} {<5to2>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<5to3>})] do_fork: T ) (command.Simple words: [{<cat>} {<5to3>} {<5to3>} {<5to3>} {<5to3>} {<5to3>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<5to4>})] do_fork: T ) (command.Simple words: [{<cat>} {<5to4>} {<5to4>} {<5to4>} {<5to4>} {<5to4>}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {<'.git/config'>} ) ] do_fork: T ) ] ) ] ) ) (C {<test_expect_success>} {(SQ <'get many entries'>)} { (SQ <'\n'> <'\tsetup_many &&\n'> <'\tgit config --get-all section.key >actual &&\n'> <'\ttest_line_count = 3126 actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'get many entries by regex'>)} { (SQ <'\n'> <'\tsetup_many &&\n'> <'\tgit config --get-regexp "sec.*ke." >actual &&\n'> <'\ttest_line_count = 3126 actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'add and replace one of many entries'>)} { (SQ <'\n'> <'\tsetup_many &&\n'> <'\tgit config --add section.key bar &&\n'> <'\tcheck_regex section.key "b.*r" bar &&\n'> <'\tgit config section.key beer "b.*r" &&\n'> <'\tcheck_regex section.key "b.*r" beer\n'> ) } ) (C {<test_expect_success>} {(SQ <'replace many entries'>)} { (SQ <'\n'> <'\tsetup_many &&\n'> <'\tgit config --replace-all section.key bar &&\n'> <'\tcheck section.key bar\n'> ) } ) (C {<test_expect_success>} {(SQ <'unset many entries'>)} { (SQ <'\n'> <'\tsetup_many &&\n'> <'\tgit config --unset-all section.key &&\n'> <'\ttest_must_fail git config section.key\n'> ) } ) (C {<test_expect_success>} {(SQ <'--add appends new value after existing empty value'>)} { (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\n'> <'\n'> <'\tfool\n'> <'\troll\n'> <'\tEOF\n'> <'\tcp .git/config .git/config.old &&\n'> <'\ttest_when_finished "mv .git/config.old .git/config" &&\n'> <'\tcat >.git/config <<-\\EOF &&\n'> <'\t[foo]\n'> <'\t\tbaz\n'> <'\t\tbaz =\n'> <'\t\tbaz = fool\n'> <'\tEOF\n'> <'\tgit config --add foo.baz roll &&\n'> <'\tgit config --get-all foo.baz >output &&\n'> <'\ttest_cmp expect output\n'> ) } ) (C {<test_done>}) ] )