(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ (Token id:Id.Lit_Chars val:'Test repository version check' span_id:15))}
          spids: [13]
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:27))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:31) 
          (Token id:Id.Lit_Chars val:'\tcat >test.patch <<-\\EOF &&\n' span_id:32) (Token id:Id.Lit_Chars val:'\tdiff --git a/test.txt b/test.txt\n' span_id:33) 
          (Token id:Id.Lit_Chars val:'\tnew file mode 100644\n' span_id:34) (Token id:Id.Lit_Chars val:'\t--- /dev/null\n' span_id:35) 
          (Token id:Id.Lit_Chars val:'\t+++ b/test.txt\n' span_id:36) (Token id:Id.Lit_Chars val:'\t@@ -0,0 +1 @@\n' span_id:37) 
          (Token id:Id.Lit_Chars val:'\t+123\n' span_id:38) (Token id:Id.Lit_Chars val:'\tEOF\n' span_id:39) (Token id:Id.Lit_Chars val:'\n' span_id:40) 
          (Token id:Id.Lit_Chars val:'\ttest_create_repo "test" &&\n' span_id:41) (Token id:Id.Lit_Chars val:'\ttest_create_repo "test2" &&\n' span_id:42) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit config --file=test2/.git/config core.repositoryformatversion 99\n'
            span_id: 43
          )
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'gitdir selection on normal repos' span_id:50))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:54) 
          (Token id:Id.Lit_Chars val:'\techo 0 >expect &&\n' span_id:55) (Token id:Id.Lit_Chars val:'\tgit config core.repositoryformatversion >actual &&\n' span_id:56) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit -C test config core.repositoryformatversion >actual2 &&\n'
            span_id: 57
          ) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual &&\n' span_id:58) 
          (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual2\n' span_id:59)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'gitdir selection on unsupported repo' span_id:66))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:70) 
          (Token
            id: Id.Lit_Chars
            val: '\t# Make sure it would stop at test2, not trash\n'
            span_id: 71
          ) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_expect_code 1 git -C test2 config core.repositoryformatversion >actual\n'
            span_id: 72
          )
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'gitdir not required mode' span_id:79))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:83) 
          (Token id:Id.Lit_Chars val:'\tgit apply --stat test.patch &&\n' span_id:84) (Token id:Id.Lit_Chars val:'\tgit -C test apply --stat ../test.patch &&\n' span_id:85) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit -C test2 apply --stat ../test.patch\n'
            span_id: 86
          )
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'gitdir required mode' span_id:93))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:97) 
          (Token
            id: Id.Lit_Chars
            val: '\tgit apply --check --index test.patch &&\n'
            span_id: 98
          ) (Token id:Id.Lit_Chars val:'\tgit -C test apply --check --index ../test.patch &&\n' span_id:99) 
          (Token
            id: Id.Lit_Chars
            val: '\ttest_must_fail git -C test2 apply --check --index ../test.patch\n'
            span_id: 100
          )
        )
      }
    )
    (command.ShFunction
      name: check_allow
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [{(git)} {(rev-parse)} {(--git-dir)}]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:118)
                      fd: -1
                      arg_word: {(actual)}
                    )
                  ]
                )
                (command.Simple
                  words: [{(echo)} {(.git)}]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_Great val:'>' span_id:128)
                      fd: -1
                      arg_word: {(expect)}
                    )
                  ]
                )
                (C {(test_cmp)} {(expect)} {(actual)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: check_abort
      body: 
        (command.BraceGroup
          children: [(C {(test_must_fail)} {(git)} {(rev-parse)} {(--git-dir)})]
        )
    )
    (command.ShFunction
      name: mkconfig
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'[core]' span_id:179))})
                (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: (Token id:Id.Op_Semi val:';' span_id:210)
                        )
                      ]
                      action: [
                        (command.AndOr
                          ops: [Id.Op_DAmp]
                          children: [
                            (C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'[extensions]' span_id:218))})
                            (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: (Token id:Id.KW_While val:while span_id:253)
      cond: [
        (command.Sentence
          child: (C {(read)} {(outcome)} {(version)} {(extensions)})
          terminator: (Token id:Id.Op_Semi val:';' span_id:262)
        )
      ]
      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.HereDoc
          op: (Token id:Id.Redir_DLess val:'<<' span_id:294)
          fd: -1
          here_begin: 
            {(word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\E' span_id:295)) 
              (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 (Token id:Id.Lit_Chars val:'precious-objects allowed' span_id:308))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:312) 
          (Token
            id: Id.Lit_Chars
            val: '\tmkconfig 1 preciousObjects >.git/config &&\n'
            span_id: 313
          ) (Token id:Id.Lit_Chars val:'\tcheck_allow\n' span_id:314)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'precious-objects blocks destructive repack' span_id:321))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:325) 
          (Token id:Id.Lit_Chars val:'\ttest_must_fail git repack -ad\n' span_id:326)
        )
      }
    )
    (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'other repacks are OK' span_id:333))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:337) 
          (Token id:Id.Lit_Chars val:'\ttest_commit foo &&\n' span_id:338) (Token id:Id.Lit_Chars val:'\tgit repack\n' span_id:339)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'precious-objects blocks prune' span_id:346))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:350) 
          (Token id:Id.Lit_Chars val:'\ttest_must_fail git prune\n' span_id:351)
        )
      }
    )
    (C {(test_expect_success)} 
      {(SQ (Token id:Id.Lit_Chars val:'gc runs without complaint' span_id:358))} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:362) 
          (Token id:Id.Lit_Chars val:'\tgit gc\n' span_id:363)
        )
      }
    )
    (C {(test_done)})
  ]
)