(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'check receive input limits'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (command.FuncDef
      name: test_pack_input_limit
      body: 
        (command.BraceGroup
          children: [
            (command.Case
              to_match: {(DQ ($ VSub_Number '$1'))}
              arms: [
                (case_arm
                  pat_list: [{(index)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:unpack_limit) op:Equal rhs:{(1)})]
                    )
                  ]
                )
                (case_arm
                  pat_list: [{(unpack)}]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (lhs_expr.LhsName name:unpack_limit)
                          op: Equal
                          rhs: {(10000)}
                        )
                      ]
                    )
                  ]
                )
              ]
            )
            (C {(test_expect_success)} {(SQ <'prepare destination repository'>)} 
              {(SQ <'\n'> <'\t\trm -fr dest &&\n'> <'\t\tgit --bare init dest\n'> <'\t'>)}
            )
            (C {(test_expect_success)} 
              {(DQ ('set unpacklimit to ') ($ VSub_DollarName '$unpack_limit'))} {(SQ <'\n'> <'\t\tgit --git-dir=dest config receive.unpacklimit "$unpack_limit"\n'> <'\t'>)}
            )
            (C {(test_expect_success)} {(SQ <'setting receive.maxInputSize to 512 rejects push'>)} 
              {
                (SQ <'\n'> <'\t\tgit --git-dir=dest config receive.maxInputSize 512 &&\n'> 
                  <'\t\ttest_must_fail git push dest HEAD\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(SQ <'bumping limit to 4k allows push'>)} 
              {
                (SQ <'\n'> <'\t\tgit --git-dir=dest config receive.maxInputSize 4k &&\n'> 
                  <'\t\tgit push dest HEAD\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} {(SQ <'prepare destination repository (again)'>)} 
              {(SQ <'\n'> <'\t\trm -fr dest &&\n'> <'\t\tgit --bare init dest\n'> <'\t'>)}
            )
            (C {(test_expect_success)} {(SQ <'lifting the limit allows push'>)} 
              {
                (SQ <'\n'> <'\t\tgit --git-dir=dest config receive.maxInputSize 0 &&\n'> 
                  <'\t\tgit push dest HEAD\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (C {(test_expect_success)} {(DQ ('create known-size (1024 bytes) commit'))} 
      {
        (SQ <'\n'> <'\ttest-genrandom foo 1024 >one-k &&\n'> <'\tgit add one-k &&\n'> 
          <'\ttest_commit one-k\n'>
        )
      }
    )
    (C {(test_pack_input_limit)} {(index)})
    (C {(test_pack_input_limit)} {(unpack)})
    (C {(test_done)})
  ]
)