Bump estimatedBytesPerCommit from 8 KiB to 64 KiB · Entire
Bump estimatedBytesPerCommit from 8 KiB to 64 KiB
3918198→main·
Soph·3mo ago·1 file·+7 added/-1 removed
8 KiB was inherited from the old probe-based planner where it was just an initial guess that probing would refine. Without probing, it needs to stand on its own as the batch count estimate. At 8 KiB, linux (~66 KiB/commit real) estimated 1 batch when the answer is ~3, forcing the PACK header pre-check to do all the work through repeated subdivisions.
64 KiB is a better general-purpose constant:
- Small repos (~5 KiB real): still estimates 1 batch (correct, harmless)
- Linux kernel (~66 KiB real): estimates 3 batches at 2 GiB limit (accurate)
- Blob-heavy monorepos (~120 KiB real): ~2x under, one PACK header split
The PACK header pre-check and target-rejection retry remain as safety nets for the cases where even 64 KiB underestimates, but they should now trigger rarely rather than routinely.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Sessions
ba0e116ded77View transcript
[?
what test coverage do we have now for replicate?Claude Code·Opus 4.6[1m]·1 step](/content/gh/entireio/git-sync/session/7b2777b1-8075-41f4-a62a-cbfc1b76c01b#timeline-ba0e116ded77/index.html)
Changes
1
internal/strategy/bootstrap
Mbootstrap.go+7/-1
423 unmodified lines
424
425
426
427
427
428
429
430
431
432
433
434
435
436
423 unmodified lines
return checkpoints, err
}
const estimatedBytesPerCommit = 8192
// estimatedBytesPerCommit is the heuristic for estimating pack size from commit
// count. Real repos range from ~5 KiB/commit (small web apps) to ~120 KiB
// (blob-heavy monorepos); most mature repos fall in 20–80 KiB. 64 KiB produces
// accurate batch counts for large repos (linux is ~66 KiB/commit) while
// slightly overestimating for small ones (harmless — extra batches finish fast).
// The PACK header pre-check and target-rejection retry catch remaining error.
const estimatedBytesPerCommit = 65536
func planCheckpointsFromChain(ctx context.Context, p Params, ref planner.DesiredRef) ([]plumbing.Hash, []plumbing.Hash, error) {
p.log("bootstrap batch fetching commit graph", "branch", ref.TargetRef.String())
Minternal/strategy/bootstrap/bootstrap.go+7/-1