(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <"Test wacky input to git config">)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: setup
      body: 
        (BraceGroup
          children: [
            (Subshell
              child: 
                (AndOr
                  children: [
                    (C {(printf)} {(DQ ("[section]") (EscapedLiteralPart token:<Lit_EscapedChar "\\n">))})
                    (C {(printf)} {(DQ ("  key = foo"))})
                  ]
                  op_id: Op_DAmp
                )
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(.git/config)} spids:[42])]
              spids: [24 40]
            )
          ]
          spids: [21]
        )
      spids: [17 20]
    )
    (FuncDef
      name: check
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Number "$2"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[67])]
            )
            (SimpleCommand
              words: [{(git)} {(config)} {(--get)} {(DQ ($ VSub_Number "$1"))}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[81])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[84])
              ]
            )
            (C {(test_cmp)} {(actual)} {(expected)})
          ]
          spids: [58]
        )
      spids: [54 57]
    )
    (FuncDef
      name: check_regex
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_Number "$3"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[116])]
            )
            (SimpleCommand
              words: [{(git)} {(config)} {(--get)} {(DQ ($ VSub_Number "$1"))} {(DQ ($ VSub_Number "$2"))}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[134])
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[137])
              ]
            )
            (C {(test_cmp)} {(actual)} {(expected)})
          ]
          spids: [107]
        )
      spids: [103 106]
    )
    (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">
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:SECTION)
          op: Equal
          rhs: 
            {
              (DQ (test.q) (EscapedLiteralPart token:<Lit_EscapedChar "\\\"">) (s) 
                (EscapedLiteralPart token:<Lit_EscapedChar "\\\\">) ("sq'sp e.key")
              )
            }
          spids: [194]
        )
      ]
      spids: [194]
    )
    (C {(test_expect_success)} {(SQ <"make sure git config escapes section names properly">)} 
      {(SQ <"\n"> <"\tgit config \"$SECTION\" bar &&\n"> <"\tcheck \"$SECTION\" bar\n">)}
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:LONG_VALUE)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(printf)} {(DQ ("x%01021dx a"))} {(7)})])
                left_token: <Left_CommandSub "$(">
                spids: [217 225]
              )
            }
          spids: [216]
        )
      ]
      spids: [216]
    )
    (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">
        )
      }
    )
    (FuncDef
      name: setup_many
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(setup)})
                (AndOr
                  children: [
                    (SimpleCommand
                      words: [{(echo)}]
                      redirects: [
                        (Redir
                          op_id: Redir_DGreat
                          fd: -1
                          arg_word: {(.git/config)}
                          spids: [263]
                        )
                      ]
                    )
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [{(cat)}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {(5to1)}
                              spids: [283]
                            )
                            (HereDoc
                              op_id: Redir_DLessDash
                              fd: -1
                              body: 
                                {("  key = foo\n") ("  key = foo\n") ("  key = foo\n") 
                                  ("  key = foo\n") ("  key = foo\n")
                                }
                              do_expansion: False
                              here_end: EOF
                              was_filled: True
                              spids: [286]
                            )
                          ]
                        )
                        (AndOr
                          children: [
                            (SimpleCommand
                              words: [{(cat)} {(5to1)} {(5to1)} {(5to1)} {(5to1)} {(5to1)}]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: -1
                                  arg_word: {(5to2)}
                                  spids: [305]
                                )
                              ]
                            )
                            (AndOr
                              children: [
                                (SimpleCommand
                                  words: [{(cat)} {(5to2)} {(5to2)} {(5to2)} {(5to2)} {(5to2)}]
                                  redirects: [
                                    (Redir
                                      op_id: Redir_Great
                                      fd: -1
                                      arg_word: {(5to3)}
                                      spids: [326]
                                    )
                                  ]
                                )
                                (AndOr
                                  children: [
                                    (SimpleCommand
                                      words: [{(cat)} {(5to3)} {(5to3)} {(5to3)} {(5to3)} {(5to3)}]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_Great
                                          fd: -1
                                          arg_word: {(5to4)}
                                          spids: [347]
                                        )
                                      ]
                                    )
                                    (SimpleCommand
                                      words: [{(cat)} {(5to4)} {(5to4)} {(5to4)} {(5to4)} {(5to4)}]
                                      redirects: [
                                        (Redir
                                          op_id: Redir_DGreat
                                          fd: -1
                                          arg_word: {(.git/config)}
                                          spids: [368]
                                        )
                                      ]
                                    )
                                  ]
                                  op_id: Op_DAmp
                                )
                              ]
                              op_id: Op_DAmp
                            )
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  op_id: Op_DAmp
                )
              ]
              op_id: Op_DAmp
            )
          ]
          spids: [245]
        )
      spids: [241 244]
    )
    (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)})
  ]
)