Wire max/batch pack byte flags into sync and replicate

main

Commit

Soph5mo ago

Replicate against a fresh target for a repo the size of linux currently fails with "decode report-status: invalid pkt-len found: short pkt-line 4" because the receive-pack POST body hits a server limit (or times out) and the target closes the connection before writing a report-status. The fix is batching, which the bootstrap strategy already supports and which replicate's bootstrap-fallback already plumbs to the strategy via Config.BatchMaxPackBytes -- but the flags were only registered on the bootstrap subcommand. Replicate and sync silently ignored them.

Changes:

  • cmd/git-sync/main.go runSyncLike: register --max-pack-bytes and --batch-max-pack-bytes. Update the usage string for sync, replicate, and plan accordingly.
  • pkg/gitsync/unstable/client.go buildSyncConfig: forward MaxPackBytes and BatchMaxPackBytes from AdvancedOptions to syncer.Config. The fields already existed on AdvancedOptions; only bootstrap was using them.
  • internal/syncer/integration_test.go: add TestRun_Integration- ReplicateBootstrapBatchesWhenConfigured exercising a replicate call with BatchMaxPackBytes set, asserting it reaches the batched bootstrap path (batching=true, batch_count>=2) and leaves source and target heads matching. This guards the plumbing; regressing the forwarding would silently reintroduce the "flag has no effect" bug.
  • CHANGELOG.md: document the added flags and the unstable buildSyncConfig forwarding.

Typical usage for a large initial replicate push:

git-sync replicate
--batch-max-pack-bytes 268435456
--max-pack-bytes 10737418240
...

splits the push into ~256 MiB batches, each of which the receive-pack server processes and acknowledges before the next starts.

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com Entire-Checkpoint: 08a1fb563aa3

Checkpoints

can you review the changes in this branch

Claude CodeOpus 4.6[1m]
View session
Checkpoint 1