Skip to content

vcs.detectRoots 在 Windows 上返回带 \\?\ 前缀的根路径 #254

Backlog

Description

@xiaoyumuxi

现象

Windows 上 vcs.detectRoots 返回的根路径带 verbatim 前缀,例如传入 C:\Users\…\workspace,返回 \\?\C:\Users\…\workspace。

原因

rust/crates/vcs/src/commands.rs 的 vcs_detect_roots_command 用 workspace.canonicalize() 解析工作区,Windows 上 std::fs::canonicalize 总是返回 \\?\ 形式,后面拼出的根路径也都带这个前缀。

影响

  • 宿主拿这个路径和自己的工作区路径比较、显示或传给插件时,会和普通写法对不上。
  • 插件后端要自己去掉前缀才能把 svn/git 等工具输出里的路径对齐。lithe-plugin-svn 已在插件里加了去前缀处理(Lithe-IDEA/lithe-plugin-svn 的 fix/windows-verbatim-root 分支),但这是对 Core 输出的补偿。
  • 复现:lithe-plugin-svn 在 main 上的 Windows 场景测试(CI run 47018791725,scenario (windows-x64))断言 root.path === workspace 失败。

期望

vcs.detectRoots 在 Windows 上返回不带 \\?\ 的普通路径(\\?\UNC\server\share 还原为 \\server\share),与 macOS 上的行为一致;在 Core 的 Windows CI 里补一条对应测试。

平台

Windows(x64,GitHub Actions windows-latest);macOS 不受影响。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions