feat(diff): 文件树标注合并冲突文件#114
Merged
Merged
Conversation
有冲突的 PR 打开 Diff 时,对会冲突的文件在状态圆点左侧标琥珀色三角警示 图标(hover 提示合并到目标分支会冲突)。冲突文件由后端就目标分支 tip ⟂ 源 head 跑本地 git merge-tree --write-tree 试合并解析得到,新增 diff:listConflictFiles 通道,仅 pr.hasConflict 为真时实际试合并、失败保守不标记。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
背景
有冲突的 PR 此前只在 PR 头部有一个总的「冲突」标记,用户无法直接知道哪些文件会冲突,只能逐个查看或到平台上看。
改动
pr.hasConflict)打开 Diff 时,文件树对会冲突的文件在右侧状态圆点左侧标一个琥珀色三角警示图标,hover 提示「合并到目标分支会产生冲突」,一眼定位冲突所在。git merge-tree --write-tree --name-only -z试合并解析得到(git ≥ 2.38):diff:listConflictFiles;仅pr.hasConflict为真时才实际试合并,否则直接返回空(省一次本地试合并)。merge-tree冲突时退出码为 1 且把结果写到 stdout,simple-git 会因非零退出吞掉 stdout,故该命令走execFile自行捕获。useConflictFileshook +ConflictIcon(内联 SVG 三角叹号)+.tree-conflict样式 +fileTree.conflictTitle四语言文案。测试
packages/repo-mirror:新增parseMergeTreeConflictsZ解析单测(含路径含空格 / 去重 / 无冲突段)+listConflictFiles集成测试(真实建两分支同行冲突,断言仅冲突文件命中、同 sha 自合并为空)。🤖 Generated with Claude Code