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": "Identidad de Git",
"gitView.header.noIdentity": "Sem identidade",
"gitView.header.noProfiles": "Não há perfiles disponíveis para aplicar.",
"gitView.header.repositoryViews": "Visualizações do repositório",
"gitView.header.removeRemoteAria": "Excluir remoto",
"gitView.header.removeRemoteTitle": "Excluir remoto",
"gitView.header.upstreamSynced": "sincronizado",
"gitView.header.upstreamTooltip": "Comparado com {target}.",
"gitView.header.upstreamTooltipTracking": "Comparado com {target}. Os indicadores principais de sincronização ainda refletem {tracking}.",
"gitView.history.actions.cancelButton": "Cancelar",
"gitView.history.actions.checkoutConfirm": "Fazer checkout deste commit como HEAD destacado?",
"gitView.history.actions.cherryPickConfirm": "Aplicar cherry-pick deste commit na branch atual?",
"gitView.history.actions.conflictToastDescription": "Conflitos em: {files}. Resolva manualmente e faça commit, ou aborte com git cherry-pick/revert --abort.",
"gitView.history.actions.conflictToastTitle": "Conflito",
"gitView.history.actions.confirmButton": "Confirmar",
"gitView.history.actions.mergeConfirm": "Fazer merge deste commit na branch atual?",
"gitView.history.actions.rebaseConfirm": "Fazer rebase da branch atual neste commit?",
"gitView.history.actions.resetHardConfirm": "Reset hard — HEAD muda e todas as alterações sem commit são descartadas permanentemente.",
"gitView.history.actions.resetMixedConfirm": "Reset mixed — HEAD muda e as alterações ficam fora do stage.",
"gitView.history.actions.resetSoftConfirm": "Reset soft — HEAD muda e as alterações em stage são preservadas.",
"gitView.history.actions.revertConfirm": "Preparar uma reversão deste commit?",
"gitView.history.actions.checkout": "Checkout",
"gitView.history.actions.cherryPick": "Cherry-pick",
"gitView.history.actions.createBranch": "Criar branch aqui",
"gitView.history.actions.createBranchConfirm": "Criar",
"gitView.history.actions.createBranchPlaceholder": "Nome da branch",
"gitView.history.actions.detachedHead": "Checkout concluído (HEAD destacado)",
"gitView.history.actions.merge": "Merge na atual",
"gitView.history.actions.rebase": "Rebase neste commit",
"gitView.history.actions.reset": "Reset...",
"gitView.history.actions.resetHard": "Hard — descartar todas as alterações",
"gitView.history.actions.resetHardConfirmButton": "Descartar alterações",
"gitView.history.actions.resetMixed": "Mixed — remover do stage",
"gitView.history.actions.resetSoft": "Soft — manter em stage",
"gitView.history.actions.revert": "Reverter",
"gitView.history.binary": "Binario",
"gitView.history.binaryNoDiff": "Arquivo binário — diff não disponível",
"gitView.history.commitsPlaceholder": "Buscar commits...",
@@ -518,6 +546,8 @@ export const dict: Record<I18nKey, string> = {
"gitView.history.largeDiffTitle": "Diff grande ({count} linhas alteradas)",
"gitView.history.loadingDiff": "Carregando diff...",
"gitView.history.loadingFiles": "Carregando arquivos...",
"gitView.history.loadMore": "Carregar mais",
"gitView.history.loadingMore": "Carregando...",
"gitView.history.logSize100": "100 commits",
"gitView.history.logSize25": "25 commits",
"gitView.history.logSize50": "50 commits",
@@ -526,6 +556,7 @@ export const dict: Record<I18nKey, string> = {
"gitView.history.renamedNoDiff": "Arquivo renomeado — diff não suportado",
"gitView.history.renderDiffAnyway": "Renderizar mesmo assim",
"gitView.history.title": "Histórico",
"gitView.graph.title": "Grafo",
"gitView.integrate.checking": "Verificando…",
"gitView.integrate.cherryPickAbortedToast": "Cherry-pick abortado",
"gitView.integrate.cherryPickConflictDescription": "Resuelve os conflitos de cherry-pick para continuar.",