Skip to content

feat(reflog): show a reflog entry's commit in the graph - #120

Open
patrick-cst1 wants to merge 1 commit into
the0807:mainfrom
patrick-cst1:feat/reflog-show-in-graph
Open

patrick-cst1 wants to merge 1 commit into
the0807:mainfrom
patrick-cst1:feat/reflog-show-in-graph

Conversation

@patrick-cst1

Copy link
Copy Markdown

Summary

  • Adds Show in Graph to the reflog entry context menu: it switches to the graph view and locates the corresponding commit.
  • Already loaded: selects the commit and scrolls to it in place (no reload, no message round-trip).
  • Not loaded (older than the loaded window, or dangling/unreachable): the extension fetches a pinned slice starting at that commit (git log <hash> --max-count=N, hash as the sole walk start point) and posts it with pinnedHash. The graph selects/scrolls to it and shows a dismissible banner ("Showing commit from reflog" + Clear) to return to the normal graph.
  • Unknown/stale/garbage-collected hashes produce a clean error notification instead of failing silently.

Related Issue

Closes #119

Changes

  • Extension: GitService.logPinnedCommit() (shared BASE_LOG_FORMAT with log(); hash validation rejects option-like/non-hex), revealCommitInGraph message, MainPanel handler (validates via searchByHash, builds the graph with buildFullGraph, posts logData with the new optional pinnedHash), CommitGraphData.pinnedHash.
  • Webview: uiStore.pinnedHash, App.handleShowInGraph/clearPinnedGraph, pinned banner in the graph view, Reflog onShowInGraph prop + menu item, i18n keys in en/ko/zh.
  • Tests: new git-service.pinned.test.ts; MainPanel routing/error/pin-clearing; Reflog menu callback; App v1/v2 routing and banner Clear.

Type of Change

  • New feature
  • Test addition or update

Testing

  • New tests fail on unmodified main (20 failing assertions: missing logPinnedCommit, message and handlers) and pass with the change.
  • npx tsc --noEmit clean; svelte-check 0 errors / 0 warnings; i18n parity test passes.
  • Full suite: 1902 tests, 260 pre-existing Windows/env failures, 0 new failures vs main.

Caveats

  • The pinned view replaces the normal graph until Clear, a normal refresh, a full refresh, or a panel/repo reload; the banner is the affordance back.
  • The pinned slice is limited to gitGraphPlus.initialCommitCount commits starting at the reflog commit; hasMore is disabled in pinned mode.
  • Re-invoking Show in Graph for the commit that is already pinned applies the selection but does not re-run the scroll if the navigation target is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Reflog: Show in Graph to locate a reflog entry's commit

1 participant