OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-sync commits / d53bff7

pull: STOP wiping healthy repos on transient fetch failure
Previous condition was: if (this._isStuck(repoPath, packDir) || !wasStuck) { wipe } The `|| !wasStuck` branch triggered force-reclone on ANY fetch failure when the repo had been healthy at start — e.g. network hiccup, peer unreachable, DNS blip, remote daemon down. Wipes a perfectly-good bare repo and tries a fresh clone; if THAT also fails, repo is left empty. On stortron today this wiped dozens of repos in a single boot when transient errors happened. Correct condition: only wipe when the repo is GENUINELY stuck (tmp_packs + no refs, detected by _isStuck) AND we didn't already wipe at the start of this pull (wasStuck). Generic fetch failure means "try again later", not "destroy local state." Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d53bff74a80712684804794a7d4c1fd465856ba9
by plankatron <fleeky@gmail.com> · 2026-04-22T01:45:37.000Z

Changed files (1) +9 -3

index.js +9 -3
……@@ -281,9 +281,15 @@ module.exports = class HyperSync extends ReadyResource {
281281 result.synced.push(name);
282282 this.emit('pull', remoteName, name, 'complete');
283283 } else {
284 // Last resort — wipe + fresh clone. Catches repos where the
285 // on-disk state is wedged in a way --refetch can't fix either.
286 if (this._isStuck(repoPath, packDir) || !wasStuck) {
284 // Last resort — wipe + fresh clone ONLY when the repo is
285 // genuinely stuck (tmp_packs + no refs) AND we haven't
286 // already tried the pre-loop force-reclone (wasStuck). Do
287 // NOT wipe on generic fetch failure — that can mean network
288 // hiccup, peer unreachable, remote down, etc., and wiping
289 // would destroy a perfectly-good repo. Previous logic
290 // (`|| !wasStuck`) was backwards and nuked healthy repos on
291 // any transient fetch error.
292 if (!wasStuck && this._isStuck(repoPath, packDir)) {
287293 fs.rmSync(repoPath, { recursive: true, force: true });
288294 try {
289295 await this._exec('git', ['init', '--bare', repoPath]);