git-remote-entire: hold a pushed pack once; bound the replica cache
Commit
A push read all of send-pack's output into one growing buffer, then copied the whole body again to amend the agent capability on its first line. A 64 MiB push allocated 224 MiB; it now allocates 65 MiB. The request is kept as the chunks it was read in (gitproto.RequestBody), the amend copies only the first chunk, and the body is replayed through an io.SectionReader with ContentLength and GetBody set explicitly. The v0/v1 connect path had the same buffering and gets the same fix.
The replica cache never removed expired entries and rewrote all of nodes.json under its exclusive lock on every info/refs response. Expired entries are now pruned on every write, and Persist skips the write when the same replica set is cached with more than half its TTL left.
Fixes #2985
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Entire-Checkpoint: 01M679VD5NVJXMNGQ00H59PYPY