Simplify after review: dedupe, trim comments, flatten conditionals

main

Commit

Soph4mo ago
  • Extract addPruneCandidates helper; the prune-managed switch is no longer pasted into both BuildPlans and BuildReplicationPlans.
  • Extract syncSession.finalizeCounts; the applyRejections + counter loop block is no longer duplicated between runSync and runReplicate.
  • Use convert.DesiredRefsForPlans in the bootstrap tail phase instead of building gitproto.DesiredRef inline.
  • Drop the defensive pushed < 0 clamp in bootstrapWithInputs; if Pushed and Warned ever disagreed, masking it would hide the bug.
  • Fold the "AllRefs implies BestEffort" coupling into allRefsFlag via cobra PreRunE instead of pasting the if-statement into two RunE bodies.
  • Flatten the 3-level nested conditional in NormalizeMapping.
  • Trim verbose doc blocks: RefKind, ActionWarn, RefScope.AllRefs, SyncPolicy.BestEffort, Pusher.OnRejection, syncSession.rejections, the bootstrap tail-phase comment, and the test docstrings that narrated motivation rather than the assertion. Removes the two empty-branch comments in the count switches by collapsing ActionWarn/Skip/Block into one no-op branch.

Net: -89 lines, all 8 AllRefs integration + smoke tests still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com Entire-Checkpoint: f8bbc26df8b3

Checkpoints

does git-sync handle any ref or just branches

Claude CodeOpus 4.7[1m]
View session
Checkpoint 1