fix(windows): send diff pathspecs the shared core accepts - #102
Closed
yangboxuan726 wants to merge 1 commit into
Closed
fix(windows): send diff pathspecs the shared core accepts#102yangboxuan726 wants to merge 1 commit into
yangboxuan726 wants to merge 1 commit into
Conversation
- 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
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Windows 的单文件 diff 与变更统计两条通路把
filePath映射进了 Core 不认识的paths字段,而git.diff契约要求pathspecs且拒绝空数组(mod.rs校验pathspecs非空):getFileDiff静默失败返回 null → 上层回退为打开原文件,diff 视图永远不出现,且无任何报错;git_status_diff_stats同样被拒 → Changes 列表完全没有 +/- 行数统计;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:通过关联