OverviewFilesCommitsIssuesDocsReleasesPeers

pear-git commits / 0f6f4a6

Announce DHT topic when new repos are created at runtime
_initBareRepo creates repos from federation peers but never announced them on the DHT. Other peers couldn't fetch via punch:// because the topic wasn't being served. topicManager is now passed to GitSyncClientManager and called after _initBareRepo + register. Set after topicManager.init() (same pattern as gitP2PHandler). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0f6f4a6f1280c4793fa92fe93e25951781f9ece2
by plankatron <fleeky@gmail.com> · 2026-04-07T01:59:34.000Z

Changed files (2) +9 -0

lib/p2p/sync/git-sync-client-manager.js +6 -0
……@@ -39,6 +39,7 @@ export class GitSyncClientManager {
3939 this.reposDir = opts.reposDir
4040 this._repoRegistry = opts.repoRegistry || null // For auto-installing hooks on new repos
4141 this._repos = opts.repos || null // In-memory repos array (server.repos) — updated after sync
42 this._topicManager = opts.topicManager || null // Announce new repos on DHT at runtime
4243 this.linkedRepos = opts.linkedRepos || null // Map<repoName, LinkedRepo> for issue Autobase keys
4344 this.appDir = opts.appDir || null // Installed app directory (for self-update)
4445 this.appRepoName = opts.appRepoName || null // This app's repo name (e.g., 'pear-git')
……@@ -465,6 +466,11 @@ export class GitSyncClientManager {
465466 this._repos.push({ name: repoName, path: repoPath, visibility: 'public' })
466467 }
467468 }
469
470 // Announce on DHT so other peers can fetch via punch://
471 if (this._topicManager) {
472 await this._topicManager.announceRepo(repoName)
473 }
468474 }
469475 }
470476
pear-git-server.js +3 -0
……@@ -1029,6 +1029,7 @@ class PearGitServer {
10291029 repos: this.repos,
10301030 linkedRepos: this.linkedRepos,
10311031 serverKey: selfServerKey,
1032 topicManager: this.topicManager || null,
10321033 appDir: selfUpdateConfig ? selfUpdateConfig.appDir : null,
10331034 appRepoName: selfUpdateConfig ? selfUpdateConfig.appRepoName : null,
10341035 onIssueKeyReceived: (repoName, remoteKey, peerServerKey) => {
……@@ -1173,6 +1174,8 @@ class PearGitServer {
11731174
11741175 // Set topicManager on handler (needed for admin create-repo announcements)
11751176 this.gitP2PHandler.topicManager = this.topicManager
1177 // Set topicManager on GitSync client (needed for announcing runtime-created repos)
1178 if (this.gitSyncClientManager) this.gitSyncClientManager._topicManager = this.topicManager
11761179 // Set server ref so admin create-repo can update in-memory repos cache
11771180 this.gitP2PHandler.server = this
11781181