(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Test repository version check'>)}
          spids: [13]
        )
      ]
    )
    (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.ShFunction
      name: check_allow
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [{<git>} {<rev-parse>} {<--git-dir>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})]
                  do_fork: T
                )
                (command.Simple
                  words: [{<echo>} {<.git>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})]
                  do_fork: T
                )
                (C {<test_cmp>} {<expect>} {<actual>})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: check_abort
      body: (BraceGroup children:[(C {<test_must_fail>} {<git>} {<rev-parse>} {<--git-dir>})])
    )
    (command.ShFunction
      name: mkconfig
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {<echo>} {(SQ <'[core]'>)})
                (C {<echo>} {(DQ <'repositoryformatversion = '> ($ Id.VSub_Number '$1'))})
                (C {<shift>})
                (command.If
                  arms: [
                    (if_arm
                      cond: [
                        (command.Sentence
                          child: (C {<test>} {($ Id.VSub_Pound '$#')} {<-gt>} {<0>})
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                      action: [
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {<echo>} {(SQ <'[extensions]'>)})
                            (command.ForEach
                              iter_name: i
                              iter_words: [{(DQ ($ Id.VSub_At '$@'))}]
                              do_arg_iter: F
                              body: 
                                (command.DoGroup
                                  children: [(C {<echo>} {(DQ ($ Id.VSub_DollarName '$i'))})]
                                )
                            )
                          ]
                        )
                      ]
                      spids: [201 212]
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: [
        (command.Sentence
          child: (C {<read>} {<outcome>} {<version>} {<extensions>})
          terminator: <Id.Op_Semi _>
        )
      ]
      body: 
        (command.DoGroup
          children: [
            (C {<test_expect_success>} 
              {
                (DQ ($ Id.VSub_DollarName '$outcome') <' version='> ($ Id.VSub_DollarName '$version') 
                  <' '> ($ Id.VSub_DollarName '$extensions')
                )
              } 
              {
                (DQ <'\n'> <'\t\tmkconfig '> ($ Id.VSub_DollarName '$version') <' '> 
                  ($ Id.VSub_DollarName '$extensions') <' >.git/config &&\n'> <'\t\tcheck_'> (${ Id.VSub_Name outcome) <'\n'> <'\t'>
                )
              }
            )
          ]
        )
      redirects: [
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.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>})
  ]
)