gitproto: show pack-encode progress during materialized push

main

Commit

Soph4mo ago

Spooling the receive-pack body to a temp file (see previous commit) introduced a silent gap between "starting push" and "uploading" that can run into minutes for large repos. Add a transient in-place progress line that updates every 500ms while encoding, finalized with a permanent "encoded pack" line on completion.

The encoder has two phases visible to the caller — delta selection (no writes) and pack write (steady stream). Distinguish them in the output using the 12-byte pack header as the phase boundary:

target: selecting deltas, elapsed 50s target: encoding pack: 46.7 MB, elapsed 1m10s target: encoded pack: 47.3 MB in 1m12s

Without the phase distinction the byte counter would sit near zero through the long selection phase ("encoding pack: 6 KB, elapsed 50s") and look like a hang or measurement bug. Splitting it makes both phases legible.

Writes go through conn.ProgressWriter() with a "target: " prefix, so they route through the existing sessionStderr → setTransient path that already handles sideband progress from upload-pack and receive-pack ("Compressing objects: X%\r" etc.). Visually consistent with what users already see during fetch and push.

Off in non-verbose mode (progressSink returns nil and the progress goroutine never starts), so quiet runs stay quiet.

Entire-Checkpoint: fc719cc95e77

Checkpoints

git-sync on  main [$!?] via 🐹 v1.26.2 on ☁️ (us-east-2) took 1m26s

Claude Code
View session
Checkpoint 1