OverviewFilesCommitsIssuesDocsReleasesPeers

pear-git commits / c87899e

Fix federation sync: fast-forward only, prevent ref rewind
Root cause of stale deploy refs: federation syncRepo used force-update (+refs/*:refs/*) which allowed a stale peer to overwrite newer commits on the origin. Stortron (with v3) synced from itself via topic routing, then the bidirectional sync pushed v3 back to tabertron, reverting v5. Fix: remove '+' prefix from refspec so git rejects non-fast-forward updates. Also remove --prune to prevent deleting branches the origin still has but the stale peer doesn't. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c87899e6600da97ed484d5bda2f3cddbd5a494ab
by plankatron <fleeky@gmail.com> · 2026-04-07T03:52:28.000Z

Changed files (1) +4 -1

lib/p2p/protocol/git-p2p-handler.js +4 -1
……@@ -469,9 +469,12 @@ export class GitP2PHandler {
469469 try {
470470 await new Promise((resolve, reject) => {
471471 let done = false
472 // Fast-forward only — never rewind refs from a stale peer.
473 // Without '+' prefix, git refuses non-fast-forward updates,
474 // preventing a stale federation peer from overwriting newer commits.
472475 const child = spawn('git', [
473476 '-C', repoPath, 'fetch', fetchUrl,
474 '+refs/*:refs/*', '--no-tags', '--prune'
477 'refs/*:refs/*', '--no-tags'
475478 ])
476479 const timer = setTimeout(() => {
477480 if (done) return