feat(git-graph): VS Code-style git graph with commit actions in History modal (#1431)

* feat(types): add parents to GitLogEntry and new commit action types

* feat(git): add parent hashes and --all flag to getLog

* fix(git): move record separator to start of log format string

* feat(git): add checkoutCommit server function and route

* feat(git): add cherryPick server function and route

* feat(git): add revertCommit server function and route

* feat(git): add resetToCommit server function and route

* fix(tests): make git service tests branch-name portable, add error path tests

* feat(client): add checkoutCommit, cherryPick, revertCommit, resetToCommit API wrappers

* feat(git-graph): add lane assignment algorithm with tests

* feat(git-graph): add GitGraphSegment per-row SVG renderer

* feat(i18n): add locale strings for git graph action buttons

* fix(git-graph): handle lane convergence, fix SVG path coords, add connector tests

* feat(git-graph): add ref badges and action buttons to HistoryCommitRow

* fix(git-graph): add loading guards to reset actions, use theme tokens for ref badges

* fix(git-graph): conditional hooks, stale graph log, conflict handling, i18n

* fix(types): replace toBeDefined with toBeTruthy, fix toast API usage

* fix(lint): remove unused variables

* fix(git-graph): fix SVG height causing 150px row spacing

* fix(git-graph): smooth bezier curves, fill row height, round line caps

* fix(git-graph): non-scaling-stroke fixes bezier white spaces, sort curves on top

* fix(git-graph): remove viewBox scaling, match SVG height to actual row height

* fix(git-graph): ResizeObserver tracks actual row height, eliminates SVG height mismatch

* feat(git-graph): replace SVG with Canvas for graph rendering

* fix(git-graph): isolate canvas from flex layout to prevent replaced-element height leak

* feat(git-graph): align action buttons, add confirmation popups for all actions

* fix(git-graph): address code review findings CR-001 through CR-005

- CR-001: VS Code getGitLog now forwards 'all' option and parses %P parents
- CR-002: VS Code bridge/gitService implement checkoutCommit, cherryPick,
  revertCommit, resetToCommit with conflict detection and hard-reset guard
- CR-003: server-side commit hash validated with /^[0-9a-fA-F]{7,40}$/
  in both routes.js and service.js; 12 new rejection tests added
- CR-004: cherry-pick/revert conflict path now refreshes fetchStatus/
  fetchBranches/fetchLog; conflict toast uses i18n keys in all 7 locales
- CR-005: corrected O(n) comment to O(n x lanes)

* fix(i18n): add zh-TW locale and common.language.traditionalChinese key to all locales

upstream/main added zh-TW.ts after branch diverged; CI type-check fails
when PR is merged because zh-TW.ts was missing all gitView.history.actions.*
keys and loadMore/loadingMore. Also adds common.language.traditionalChinese
to en.ts and all 6 non-English files to match upstream en.ts.

* fix: harden git history actions

* feat: split git history graph view

* chore: remove git graph planning docs

---------

Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Erman HAVUÇ
2026-05-27 00:13:25 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent cc3d1bd63c
commit 52ffe9daef
26 changed files with 2373 additions and 111 deletions
@@ -504,11 +504,39 @@ export const dict: Record<I18nKey, string> = {
'gitView.header.identityTooltip': 'Git 身份',
'gitView.header.noIdentity': '无身份',
'gitView.header.noProfiles': '没有可应用的配置。',
'gitView.header.repositoryViews': '仓库视图',
'gitView.header.removeRemoteAria': '移除远程 {name}',
'gitView.header.removeRemoteTitle': '移除 {name}',
'gitView.header.upstreamSynced': '已同步',
'gitView.header.upstreamTooltip': '与 {target} 对比。',
'gitView.header.upstreamTooltipTracking': '与 {target} 对比。主要同步徽标仍然反映 {tracking}。',
'gitView.history.actions.cancelButton': '取消',
'gitView.history.actions.checkoutConfirm': '要将此提交检出为 detached HEAD 吗?',
'gitView.history.actions.cherryPickConfirm': '要将此提交 cherry-pick 到当前分支吗?',
'gitView.history.actions.conflictToastDescription': '冲突文件:{files}。请手动解决并提交,或使用 git cherry-pick/revert --abort 中止。',
'gitView.history.actions.conflictToastTitle': '冲突',
'gitView.history.actions.confirmButton': '确认',
'gitView.history.actions.mergeConfirm': '要将此提交合并到当前分支吗?',
'gitView.history.actions.rebaseConfirm': '要将当前分支变基到此提交吗?',
'gitView.history.actions.resetHardConfirm': 'Hard reset — HEAD 会移动,所有未提交更改将被永久丢弃。',
'gitView.history.actions.resetMixedConfirm': 'Mixed reset — HEAD 会移动,更改将取消暂存。',
'gitView.history.actions.resetSoftConfirm': 'Soft reset — HEAD 会移动,已暂存更改会保留。',
'gitView.history.actions.revertConfirm': '要暂存对此提交的 revert 吗?',
'gitView.history.actions.checkout': '检出',
'gitView.history.actions.cherryPick': 'Cherry-pick',
'gitView.history.actions.createBranch': '在此创建分支',
'gitView.history.actions.createBranchConfirm': '创建',
'gitView.history.actions.createBranchPlaceholder': '分支名称',
'gitView.history.actions.detachedHead': '已检出(detached HEAD)',
'gitView.history.actions.merge': '合并到当前分支',
'gitView.history.actions.rebase': '变基到此处',
'gitView.history.actions.reset': 'Reset...',
'gitView.history.actions.resetHard': 'Hard — 丢弃所有更改',
'gitView.history.actions.resetHardConfirmButton': '丢弃更改',
'gitView.history.actions.resetMixed': 'Mixed — 取消暂存更改',
'gitView.history.actions.resetSoft': 'Soft — 保留暂存',
'gitView.history.actions.revert': 'Revert',
'gitView.history.binary': '二进制',
'gitView.history.binaryNoDiff': '二进制文件,无法显示差异',
'gitView.history.commitsPlaceholder': '提交数',
@@ -518,6 +546,8 @@ export const dict: Record<I18nKey, string> = {
'gitView.history.largeDiffTitle': '大型差异({count} 行变更)',
'gitView.history.loadingDiff': '正在加载差异...',
'gitView.history.loadingFiles': '正在加载文件...',
'gitView.history.loadMore': '加载更多',
'gitView.history.loadingMore': '加载中...',
'gitView.history.logSize100': '100 个提交',
'gitView.history.logSize25': '25 个提交',
'gitView.history.logSize50': '50 个提交',
@@ -526,6 +556,7 @@ export const dict: Record<I18nKey, string> = {
'gitView.history.renamedNoDiff': '已重命名文件,不支持显示差异',
'gitView.history.renderDiffAnyway': '仍然渲染',
'gitView.history.title': '历史',
'gitView.graph.title': '图谱',
'gitView.integrate.checking': '检查中…',
'gitView.integrate.cherryPickAbortedToast': '已中止 cherry-pick',
'gitView.integrate.cherryPickConflictDescription': '请先解决冲突,然后继续。',