fix(GitToolWindow): 修复活动栏未提交角标缺失与 Branches Push 失败 - #17
Merged
Conversation
Changes 视图由 registerTreeDataProvider 改为 createTreeView 以获取 TreeView 句柄承载 .badge;活动栏容器图标的数字角标为容器内各视图 badge.value 之和,故为 hyperGit.changes 设置角标即点亮 Hyper Git 图标。 计数复用 service.getChanges()(index+工作区+未跟踪去重),接入既有 refreshAll 防抖刷新链路与首帧保险,计数为 0 时清空,对齐原生 SCM 行为。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
hyperGit.push 原以零参数调用 repo.push(),当前分支无上游时 git push (push.default=simple)必然失败,vscode.git 包装为 GitError,其 .message 为通用串「Failed to execute git」,真实 stderr 被吞没。 改为以 HEAD.upstream 是否存在为分支:有上游沿用 repo.push();无上游时 选定 remote(单 remote 直用、多 remote 弹选择)并以 repo.push(remote, branch, true) 建立 -u 追踪。同时增强 errMsg 优先暴露 GitError.stderr, 使「无上游」「non-fast-forward」等失败可读(push/pull/fetch 等同享)。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.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.
背景
v0.0.3 中用户截图反馈两处缺陷:
根因
hyperGit.changes经registerTreeDataProvider注册,该 API 返回Disposable而非TreeView,无对象可承载.badge,全仓不存在角标代码。hyperGit.push以零参数调repo.push();当前活动分支无上游时git push(push.default=simple)必然失败,vscode.git 将其包装为GitError,其.message恰为通用串「Failed to execute git」,真实 stderr 被errMsg吞没。修复
src/extension.ts):改用createTreeView获取TreeView句柄;新增updateChangesBadge(),计数复用service.getChanges()(index+工作区+未跟踪去重),接入既有refreshAll防抖链路与首帧保险,计数为 0 时清空,对齐原生 SCM。活动栏容器图标角标 = 容器内各视图badge.value之和。src/adapter/history-commands.ts):以HEAD.upstream是否存在分流——有上游沿用repo.push();无上游选定 remote(单个直用 / 多个弹选)并以repo.push(remote, branch, true)建立-u追踪。增强errMsg优先暴露GitError.stderr,使「无上游」「non-fast-forward」等失败可读(push/pull/fetch 等同享)。验证
check-types/lint/package(esbuild)/test:unit(166/166)本地全绿。影响面
package.json命令/菜单(hyperGit.push仍注册);对「有上游」分支 Push 行为不变;不引入强推/危险操作(force 仍仅在pushDialog提供)。🤖 Generated with Claude Code, CodeX, Gemini
Co-Authored-By: Aurelius Huangthreefish.ai@gmail.com