(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Test repository version check'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\tcat >test.patch <<-\\EOF &&\n'> <'\tdiff --git a/test.txt b/test.txt\n'> 
          <'\tnew file mode 100644\n'> <'\t--- /dev/null\n'> <'\t+++ b/test.txt\n'> <'\t@@ -0,0 +1 @@\n'> <'\t+123\n'> <'\tEOF\n'> <'\n'> 
          <'\ttest_create_repo "test" &&\n'> <'\ttest_create_repo "test2" &&\n'> 
          <'\tgit config --file=test2/.git/config core.repositoryformatversion 99\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'gitdir selection on normal repos'>)} 
      {
        (SQ <'\n'> <'\techo 0 >expect &&\n'> <'\tgit config core.repositoryformatversion >actual &&\n'> 
          <'\tgit -C test config core.repositoryformatversion >actual2 &&\n'> <'\ttest_cmp expect actual &&\n'> <'\ttest_cmp expect actual2\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'gitdir selection on unsupported repo'>)} 
      {
        (SQ <'\n'> <'\t# Make sure it would stop at test2, not trash\n'> 
          <'\ttest_expect_code 1 git -C test2 config core.repositoryformatversion >actual\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'gitdir not required mode'>)} 
      {
        (SQ <'\n'> <'\tgit apply --stat test.patch &&\n'> 
          <'\tgit -C test apply --stat ../test.patch &&\n'> <'\tgit -C test2 apply --stat ../test.patch\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'gitdir required mode'>)} 
      {
        (SQ <'\n'> <'\tgit apply --check --index test.patch &&\n'> 
          <'\tgit -C test apply --check --index ../test.patch &&\n'> <'\ttest_must_fail git -C test2 apply --check --index ../test.patch\n'>
        )
      }
    )
    (command.FuncDef
      name: check_allow
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp]
              children: [
                (command.SimpleCommand
                  words: [{(git)} {(rev-parse)} {(--git-dir)}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})]
                )
                (command.SimpleCommand
                  words: [{(echo)} {(.git)}]
                  redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})]
                )
                (C {(test_cmp)} {(expect)} {(actual)})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: check_abort
      body: 
        (command.BraceGroup
          children: [(C {(test_must_fail)} {(git)} {(rev-parse)} {(--git-dir)})]
        )
    )
    (command.FuncDef
      name: mkconfig
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DAmp Op_DAmp Op_DAmp]
              children: [
                (C {(echo)} {(SQ <'[core]'>)})
                (C {(echo)} {(DQ ('repositoryformatversion = ') ($ VSub_Number '$1'))})
                (C {(shift)})
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: (C {(test)} {($ VSub_Pound '$#')} {(-gt)} {(0)})
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (command.AndOr
                          ops: [Op_DAmp]
                          children: [
                            (C {(echo)} {(SQ <'[extensions]'>)})
                            (command.ForEach
                              iter_name: i
                              iter_words: [{(DQ ($ VSub_At '$@'))}]
                              do_arg_iter: F
                              body: 
                                (command.DoGroup
                                  children: [(C {(echo)} {(DQ ($ VSub_DollarName '$i'))})]
                                )
                            )
                          ]
                        )
                      ]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.WhileUntil
      keyword: <KW_While while>
      cond: [
        (command.Sentence
          child: (C {(read)} {(outcome)} {(version)} {(extensions)})
          terminator: <Op_Semi ';'>
        )
      ]
      body: 
        (command.DoGroup
          children: [
            (C {(test_expect_success)} 
              {
                (DQ ($ VSub_DollarName '$outcome') (' version=') ($ VSub_DollarName '$version') (' ') 
                  ($ VSub_DollarName '$extensions')
                )
              } 
              {
                (DQ ('\n') ('\t\tmkconfig ') ($ VSub_DollarName '$version') (' ') 
                  ($ VSub_DollarName '$extensions') (' >.git/config &&\n') ('\t\tcheck_') (${ VSub_Name outcome) ('\n') ('\t')
                )
              }
            )
          ]
        )
      redirects: [
        (redir.HereDoc
          op: <Redir_DLess '<<'>
          fd: 16777215
          here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)}
          here_end_span_id: 303
          stdin_parts: [
            ('allow 0\n')
            ('allow 1\n')
            ('allow 1 noop\n')
            ('abort 1 no-such-extension\n')
            ('allow 0 no-such-extension\n')
          ]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <'precious-objects allowed'>)} 
      {(SQ <'\n'> <'\tmkconfig 1 preciousObjects >.git/config &&\n'> <'\tcheck_allow\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'precious-objects blocks destructive repack'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git repack -ad\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'other repacks are OK'>)} 
      {(SQ <'\n'> <'\ttest_commit foo &&\n'> <'\tgit repack\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'precious-objects blocks prune'>)} 
      {(SQ <'\n'> <'\ttest_must_fail git prune\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'gc runs without complaint'>)} {(SQ <'\n'> <'\tgit gc\n'>)})
    (C {(test_done)})
  ]
)