(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description spids:[4])
          op: Equal
          rhs: {(SQ <'check receive input limits'>)}
          spids: [4]
        )
      ]
      spids: [4]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: test_pack_input_limit
      body: 
        (BraceGroup
          children: [
            (Case
              to_match: {(DQ ($ VSub_Number '$1'))}
              arms: [
                (case_arm
                  pat_list: [{(index)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:unpack_limit spids:[44])
                          op: Equal
                          rhs: {(1)}
                          spids: [44]
                        )
                      ]
                      spids: [44]
                    )
                  ]
                  spids: [41 42 47 16777215]
                )
                (case_arm
                  pat_list: [{(unpack)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:unpack_limit spids:[53])
                          op: Equal
                          rhs: {(10000)}
                          spids: [53]
                        )
                      ]
                      spids: [53]
                    )
                  ]
                  spids: [50 51 56 16777215]
                )
              ]
              spids: [32 38 59]
            )
            (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_Name '$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'>
                )
              }
            )
          ]
          spids: [29]
        )
      spids: [24 28]
    )
    (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)})
  ]
)