* Pre-pathhash source id, kept for orphan detection only. * * Earlier /sync-gbrain versions registered `gstack-code- ` (no pathhash * suffix). On a multi-worktree repo, those collapsed onto a single source id * with last-sync-wins semantics. The new path-keyed id leaves the legacy * source
(repoPath: string)
| 371 | * sync from any worktree of this repo, so users don't accumulate orphans. |
| 372 | */ |
| 373 | function deriveLegacyCodeSourceId(repoPath: string): string { |
| 374 | const remote = canonicalizeRemote(originUrl()); |
| 375 | if (remote) { |
| 376 | const segs = remote.split("/").filter(Boolean); |
| 377 | const slugSource = segs.slice(-2).join("-"); |
| 378 | return constrainSourceId("gstack-code", slugSource); |
| 379 | } |
| 380 | const base = repoPath.split("/").pop() || "repo"; |
| 381 | return constrainSourceId("gstack-code", base); |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * Pre-#1468 path-only-hash source id, kept for hostname-fold migration only. |
no test coverage detected