mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-29 06:28:23 +02:00
Sharing `<workspacesRoot>/.repos/` across profiles let two daemons (Desktop's profile-suffixed daemon plus the user's default-profile CLI daemon) write into the same bare clones concurrently. repocache.repoLocks is a process-local sync.Map and cannot serialize git's own lockfiles (packed-refs.lock, config.lock, worktree admin) across processes, so simultaneous fetch / worktree-add on the same repo can fail or corrupt the cache. Derive the cache directory per-profile via repoCacheRoot(cfg): - Default profile keeps `<workspacesRoot>/.repos/` (no path change for existing CLI/Web users). - Named profile uses `<workspacesRoot>/.repos-<profile>/`, restoring the pre-PR isolation between the Desktop daemon and a user CLI daemon while still sharing the user-visible task workdirs. The startup migration relocates a legacy `.repos` cache to the new `.repos-<profile>` location so existing Desktop users don't pay a re-clone cost. If a `.repos-<profile>` is already present at the target (a previous migration ran) the legacy copy is left in place.