maxBlobBytes constant

  1. @visibleForTesting
int const maxBlobBytes

The largest blob the git-data API accepts, measured rather than read off documentation — 41,820,160 B was accepted and 41,943,040 B (exactly 40 MiB) was refused with a 422, so the ceiling is at 40 MiB and the last accepted size is the one worth naming.

Three things about this number are load-bearing, and none of them is the number:

  1. It binds on the decoded bytes, not on the request body. 39.53 MiB of content is 52.71 MiB of base64 on the wire and still lands, so the 4/3 inflation buys no smaller a limit than it looks — and GitHub's documented 100 MB per-file limit is never reached, because this one is two and a half times stricter.
  2. It is per blob. Twelve 8 MiB blobs — 96 MiB — in one tree, one commit and one ref update land fine, as do 500 entries in one tree, so there is no aggregate budget for a save to run out of.
  3. Git-LFS cannot move it. LFS is a client-side clean/smudge filter; this backend writes objects through the REST API, which never consults .gitattributes. A 1 MiB write to an LFS-tracked path stored 1 MiB of raw bytes, not a pointer.

Implementation

@visibleForTesting
static const maxBlobBytes = 41820160;