Skip to content

fix(windows): send diff pathspecs the shared core accepts - #102

Closed
soarhill wants to merge 1 commit into
1lck:preview/0.3.0from
soarhill:fix/windows-git-diff-pathspec
Closed

soarhill wants to merge 1 commit into
1lck:preview/0.3.0from
soarhill:fix/windows-git-diff-pathspec

Conversation

@soarhill

Copy link
Copy Markdown
Contributor

问题

Windows 的单文件 diff 与变更统计两条通路把 filePath 映射进了 Core 不认识的 paths 字段,而 git.diff 契约要求 pathspecs 且拒绝空数组(mod.rs 校验 pathspecs 非空):

  1. 点已修改的已跟踪文件 → Core 拒绝 → getFileDiff 静默失败返回 null → 上层回退为打开原文件,diff 视图永远不出现,且无任何报错;
  2. git_status_diff_stats 同样被拒 → Changes 列表完全没有 +/- 行数统计;
  3. stats 适配层把 staged 写死为 false,即使前两项修好,已暂存文件也永远没有统计数字。

修复

  • platform.rs:git_diff_file / git_status_diff_stats 的 filePath 改映射到 pathspecs;不带 filePath 时兜底 ["."](整树,与 git_ref_diff 现有写法一致)
  • core-result-adapter.ts:diff stats 的 staged 改从请求参数读取,不再硬编码
  • git-diff-api.ts:stats 并取未暂存 + 已暂存两组(Core 的 staged 参数现成支持),两组文件都能显示统计
  • 未跟踪文件点击直接打开原文件的既有行为保持不变

验证

  • cargo test(src-tauri):11/11 通过(新增 2 个翻译测试:带 filePath 的 pathspec 映射、stats 整树兜底)
  • bun test:12/12 通过(新增 3 个 adapter 测试:stats 双文件计数、staged 透传、单文件 diff 适配)
  • tsc --noEmit:通过
  • 真机验收通过:点已修改的已跟踪文件打开 diff 视图(修复前打开原文件);staged diff 正常;Changes 列表出现 +/- 统计(含已暂存文件);commit / stash 无回归

关联

- translate git_diff_file and git_status_diff_stats filePath into the
  git.diff pathspecs contract instead of the unrelated paths field, and
  fall back to ["."] so whole-tree stat requests are not rejected
- derive diff stat staged flags from the request instead of hardcoding
  false, and fetch staged and unstaged stats so both groups show counts
@soarhill
soarhill requested a review from 1lck as a code owner August 16, 2026 01:19
@soarhill

Copy link
Copy Markdown
Contributor Author

Superseded by #103, which carries this exact fix (verified identical commit content) plus the follow-up diff/history work. Closing to keep the review queue clean — please review #103 instead.

@soarhill soarhill closed this Aug 16, 2026
@soarhill
soarhill deleted the fix/windows-git-diff-pathspec branch August 16, 2026 13:18
xiaoyumuxi added a commit that referenced this pull request Nov 18, 2026
- 分组页改为目录页:列出「工具链」「调试器」和插件声明的构建工具、编译器页,带状态摘要
- 插件页按种类聚合,同一种类满 3 个折叠成侧栏文件夹,展开列 6 个并以「全部 N 个…」打开可筛选的文件夹页
- 插件自己的设置位置不变:插件详情的「设置」标签照样列出全部设置,聚合页和它共用同一份表单与草稿(新增回归测试)
- 工具链页按 docs/design/build-execution-settings.html 重做:全局默认 / 当前项目两个作用域、按类别或插件分组、需要处理与已手动指定过滤、列表与详情两栏、安装列表与来源标签、未信任项目的信任提示
- 筛选、分组和计数改用 Core 设置投影(Core #99 已合入;问题项带分组在 Core #102,先固定 6712596),一个插件可注册多个 SDK;固定值不再单独算一个来源标签
- 单步过滤从 Build 页移到「调试器」子页,插件没有声明名称时按调试器名绘制图标
- 只有 Build 页或有草稿时页脚才显示「应用」,没有草稿时「好」直接关闭
- 侧栏搜索覆盖目录页、工具链和调试器
- 新增 build-settings 词条,更新设置页分类笔记、新增已实现与剩余契约缺口两篇笔记,更新功能矩阵
- 截图放在 docs/assets/build-execution-settings/
xiaoyumuxi added a commit that referenced this pull request Nov 18, 2026
* build(desktop): Core 固定版本换成 main 上的 8d3c16b(#102 已合入)

* feat(desktop): 构建工具、编译器改为与工具链、调试器一样的分栏页(#2178)

- 侧栏每个有页面的种类只占一行,行尾是页面数,不再折叠成文件夹、
  也不再逐个列出插件页;插件页只在搜索命中时单独出现在侧栏。
- 点开种类是分栏页:左侧按需渲染这一类的页面和提供插件,可按页面名
  或插件名筛选,底部是页面数;右侧是选中页面的设置,和插件详情的
  「设置」标签共用同一个表单与草稿。再次打开回到上次看的页面。
- 面包屑改为「构建、执行、部署 › 种类」;目录页的种类行直接打开分栏页。
- 删除文件夹页、folderMin/folderLimit 与 folderAll 词条;新增
  kindPageCount、kindFilter、kindNoMatches 中英词条并重新生成。
- core.SettingsNavigationItem.Limit 与 SettingsNavigationRow.Overflow
  已无人使用,删除绑定字段。
- 原型 build-execution-settings.html 同步为分栏页;截图换成
  32-settings-build-kind,删除 32-settings-build-folder。
- 更新设置分类 Note、构建设置结构 Note、契约缺口 Note 和功能矩阵。
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