Skip to content

fix(worktree): incarnation 状态迁至 userData,不再污染用户项目目录 - #255

Merged
Ysheep666 merged 1 commit into
mainfrom
fix/worktree-incarnation-userdata
Oct 28, 2026
Merged

Ysheep666 merged 1 commit into
mainfrom
fix/worktree-incarnation-userdata

Conversation

@Ysheep666

Copy link
Copy Markdown
Contributor

问题

Pier 把 worktree incarnation 注册表写在打开工作区的 git 主根(.pier/worktree-incarnations.json)。在非 Pier 项目里打开仓库会留下一个 untracked .pier/ 目录,污染用户仓库状态。

改动

  • incarnation store 改为持久化到 userData/worktree-incarnations/<sha256(mainPath)>.json,按主仓库分片。
  • 生产经 wireWorktreeService(userDataDir, readPreferences) 注入 userData 根目录;测试与无法落盘时仍走进程内 Map。
  • 保留 .gitignore 对旧 .pier/worktree-incarnations.json 的忽略,避免 contributor 残留旧文件显示为 dirty。

验证

  • pnpm preflight:ci 本地绿(exit 0)。
  • tests/unit/main/git/worktree-incarnation.test.ts 覆盖 userData 分片路径、缺省 storeRootDir 内存降级与旧路径不再写盘。

原实现把 .pier/worktree-incarnations.json 写进打开工作区的 git 主根,在非 Pier 项目里留下 untracked 目录。改为持久化到 userData 下按主仓库 sha256 分片,生产经 wireWorktreeService 注入 userData 根目录,测试与降级走进程内内存。保留旧 .pier 路径的 gitignore 防御,避免 contributor 残留旧文件变 dirty。

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Ysheep666
Ysheep666 merged commit ef7936f into main Oct 28, 2026
8 checks passed
@Ysheep666
Ysheep666 deleted the fix/worktree-incarnation-userdata branch October 28, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant