Files
multica/server
Jiang Bohan 159907e4e1 fix(daemon): keep bare repo cache per-profile after workspaces unify
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.
2026-04-28 18:29:11 +08:00
..