migrate: don't clobber a valid ref on a transient refBase read error

main

Commit

Soph2mo ago

MigrateBranchToRefs collapsed every refBase error to parent=ZeroHash, so a momentary read failure — a concurrent repack, lock contention — made the migration treat a still-valid checkpoint ref as absent, wrap the branch snapshot in a fresh orphan commit, and setRef over the good ref (discarding its history; the follow-up fast-forward-only push then rejects it).

Split the cases: an absent ref stays an orphan, a ref whose commit object is genuinely missing (ErrObjectNotFound: corrupt/pruned) is still re-imported as an orphan, but any other read error now aborts the checkpoint so an idempotent re-run retries rather than rewriting a ref that was only transiently unreadable.

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

Checkpoints

Fix Git Migration Ref and Metadata Handling

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1

Investigate CLI Enable Backend Ping

Claude Code
View session
Checkpoint 1