[Feature] 远程工作区支持从上级目录开始的 Git 仓库(打开 monorepo 子目录时 Git 可用)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by reading desktop/internal/workbench/remote_git.go, especially remoteRepositoryAbove, and the test TestRemoteWorkspaceSaysItsRepositoryStartsAbove plus the string desktop.remote.workspace.gitAbove that currently only shows the "repository starts above" message. On the Core side, find where the remote scope bounds the workspace's host folder and where git.* requests are validated, so git rev-parse --show-toplevel can admit one extra repo-root prefix, then check remote.runWatch allows watching it and how remoteplaceholder.LocalPath maps to .lithe-remote-host. Done means changes outside the folder are listed, stageable, diffable and committable from the commit window while remaining unopenable in the remote editor, with the trust question for an outside repo root flagged for the #2231 security series.
由索引模型根据 Issue 内容生成。
描述
Problem to solve / 要解决的问题
远程工作区打开的主机文件夹如果位于一个从上级目录开始的 Git 仓库里(例如打开 ~/work/repo/service,而仓库根是 ~/work/repo),信任文件夹后 Git 视图不能用:Core 在主机上返回的仓库根在工作区占位目录之外,变更路径是相对仓库根的,和项目树(以主机文件夹为根)对不上。#2231 接缝④ 的 PR 里先让 Git 和提交工具窗口说明“仓库从上级目录开始,请打开仓库顶层文件夹”,不显示变更、不记为失败。用户在主机上习惯只打开 monorepo 的一个子目录时,只能改为打开整个仓库。
本机项目已经支持这种布局(本机的 Git 视图按仓库根解析路径,打开子目录也能看到并提交变更),远程工作区落后于本机。
Proposed solution / 建议方案
- 远程绑定只覆盖主机文件夹本身。让 Git 能读写文件夹以外的仓库根,需要 Core 的远程作用域允许
git.*请求访问“该工作区所在仓库的根”这一个额外前缀(由 Core 在主机上用git rev-parse --show-toplevel解析并校验,不接受客户端给出的任意路径),并在返回的路径里把仓库根下、文件夹外的路径映射到占位目录旁的保留前缀(桌面端remoteplaceholder.LocalPath已有.lithe-remote-host映射)。 - 桌面端的 Git、提交、日志、差异、逐行追溯按仓库根解析路径:文件夹内的变更照常定位到项目树;文件夹外的变更在提交窗口里列出(可暂存、提交、查看差异),但不能在编辑器里打开(远程编辑器只读写文件夹内的文件),并说明原因。
- git 目录的主机监听已按 Core 给出的 git 目录工作,仓库根在文件夹外时同样适用;需要确认
remote.runWatch允许监听该前缀。 - 远程信任:信任决定仍按主机文件夹记录;仓库根在文件夹外时,是否要求同时信任仓库根需要按 Zed 的安全设计(#2231 的 S 系列)单独评估,因为 Git 钩子和配置来自仓库根。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Remote and WSL / 远程与 WSL
Priority / 优先级
P2 / 后续考虑:目前不着急,可安排到后续版本
Alternatives considered / 已考虑的替代方案
- 打开子目录时自动改为打开仓库根:会让项目树和用户选择的文件夹不一致,也会扩大远程信任的范围,不采用。
- 桌面端自己把文件夹外的路径过滤掉、只显示文件夹内的变更:提交时会遗漏文件夹外已暂存的内容,用户看不到将被提交的全部变更,不安全,不采用。
Additional context / 补充信息
- 当前行为与提示文案在 #2231 接缝④ 的 PR 中实现:
desktop/internal/workbench/remote_git.go的remoteRepositoryAbove,测试TestRemoteWorkspaceSaysItsRepositoryStartsAbove,词条desktop.remote.workspace.gitAbove。 - 关联 #2231(远程开发完整设计)。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
- 主要语言
- TypeScript
- 星标
- 1.8k
- 派生
- 151
- 平均合并
- 3 小时 48 分钟
- 30 天内合并 PR
- 571
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
1lck/Lithe-IDEA 的其他 Issue
-
review: medium
难度 2/5 1-3 小时 新手友好度 78/100
1lck/Lithe-IDEA#2432 ·
维护者通常 1 天内回复
-
review: medium
难度 1/5 1 小时以内 新手友好度 82/100
1lck/Lithe-IDEA#2431 ·
维护者通常 1 天内回复
-
refactor review: high
难度 2/5 1-3 小时 新手友好度 72/100
1lck/Lithe-IDEA#2376 ·
维护者通常 1 天内回复
-
area:ui enhancement P2 platform:cross-platform refactor review: high
难度 1/5 1 小时以内 新手友好度 84/100
1lck/Lithe-IDEA#2365 ·
维护者通常 1 天内回复
-
review: medium
难度 3/5 1-2 天 新手友好度 57/100
1lck/Lithe-IDEA#2434 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
posit-dev/positron-sas-extension#196 ·
维护者通常 1 天内回复
-
bug composer
难度 2/5 1-3 小时 新手友好度 82/100
inmanta/web-console#8037 ·
维护者通常 1 天内回复
-
check:passed streams:add
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
bug: v5 dist/types/components.d.ts imports @stencil/core/runtime instead of ./stencil-public-runtime未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复