Resume from stale temp refs by finding their chain position
Commit

When a temp ref from a previous run doesn't match any planned checkpoint, look up its hash in the commit chain. If found, use it as the starting point and re-plan remaining checkpoints from there — preserving the data already pushed by previous batches.
Only delete the temp ref and start fresh when the hash isn't in the chain at all (truly unrelated data, not just a different checkpoint plan).
For the linux case: previous run pushed batches 1-2 (~3 GiB) and left the temp ref at a subdivide midpoint. With different --target-max-pack- bytes, the new plan doesn't include that midpoint as a checkpoint. Instead of re-pushing 3 GiB, we now find the midpoint in the chain (position ~50k of 75k), plan checkpoints for the remaining ~25k commits, and push only what's missing.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com Entire-Checkpoint: a474315dec7b