Batch ref-update commands to stay under receive-pack cap

main

Commit

Soph2mo ago

A sync of a repo with many refs sent every ref-update command in a single receive-pack request, which entire-server rejects past 25,000 commands ("too many ref-update commands: 55006 (limit 25000)"). The relay/materialize strategies (replicate, incremental, materialized) had no command-count batching.

Batch inside the gitproto push primitives so every strategy benefits:

  • PushPack / PushObjects send the pack with the first batch and the remaining refs as ref-only follow-ups. The pack carries every object for the whole push, and receive-pack commits the entire received pack (entire-server via CommitQuarantinedFanout, canonical git via tmp_objdir_migrate — neither prunes objects unreachable from the pushed tips), so later batches only move ref pointers.
  • PushCommands chunks all commands under maxRefUpdatesPerPush (20_000, with headroom under the server's 25_000 cap).

Works against both entire-server and canonical git/GitHub (GitHub's per-push branch/tag limit is opt-in, default unlimited).

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: 5d4b8f06380e

Checkpoints

We have a repo with 50k refs and we go this error: 2026/06/18 13:17:39 WARN Permanent sync error, terminating error="sync: replicate relay failed: replicate execute: push target refs: target receive-p

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1

can you take a look at:

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1