From b8b245da5f355702e91a2e598ee9afaf19fc6c5d Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 25 Nov 2026 15:31:45 -0300 Subject: [PATCH] feat(vcs): Show in Git Log in the File History commit menu, as in IDEA (#5948) A commit in a File History tab gets Show in Git Log in its context menu, after Compare with Local. It reuses the vcs.showCommit action (switch to the Log tab and select the commit) that Blame and Compare Branches already use; the plain Log menu is unchanged. Closes #5947 Co-authored-by: formiat <29867335+formiat@users.noreply.github.com> --- src/features/vcs/__tests__/historyOps.test.ts | 11 +++++++++++ src/features/vcs/log/commitMenu.ts | 1 + 2 files changed, 12 insertions(+) diff --git a/src/features/vcs/__tests__/historyOps.test.ts b/src/features/vcs/__tests__/historyOps.test.ts index b469ce47b0..d7c4881d6d 100644 --- a/src/features/vcs/__tests__/historyOps.test.ts +++ b/src/features/vcs/__tests__/historyOps.test.ts @@ -135,6 +135,17 @@ describe("Git Log commit actions", () => { expect(commitMenu(c).some((i) => "action" in i && i.action === "vcs.log.showFileAtRevision")).toBe(false); }); + it("offers Show in Git Log in a File History commit menu, after Compare with Local (IDEA)", () => { + const c = commit("Rename file"); + const order = menuOrder(commitMenu(c, [c], "/repo/new.txt")); + expect( + order.slice(order.indexOf("vcs.log.compareWithLocal"), order.indexOf("vcs.log.compareWithLocal") + 2), + ).toEqual(["vcs.log.compareWithLocal", "vcs.showCommit"]); + const item = commitMenu(c, [c], "/repo/new.txt").find((i) => "action" in i && i.action === "vcs.showCommit"); + expect(item).toMatchObject({ label: "Show in Git Log", arg: c, disabled: false }); + expect(commitMenu(c).some((i) => "action" in i && i.action === "vcs.showCommit")).toBe(false); + }); + it("offers history rewriting for pushed commits too (IDEA allows it; the run confirms)", () => { const local = commit("Local", "1".repeat(40)); const pushed = commit("Pushed", "2".repeat(40)); diff --git a/src/features/vcs/log/commitMenu.ts b/src/features/vcs/log/commitMenu.ts index e94bf6c76d..b6115b6346 100644 --- a/src/features/vcs/log/commitMenu.ts +++ b/src/features/vcs/log/commitMenu.ts @@ -109,6 +109,7 @@ export function commitMenu(c: Commit, selection: Commit[] = [c], fileHistoryTarg ? [{ kind: "action" as const, action: "vcs.log.compareVersions", arg: compareArg, icon: null }] : []), single("vcs.log.compareWithLocal", { arg: actionCommit }), + ...(fileHistoryTarget ? [single("vcs.showCommit", { label: "Show in Git Log" })] : []), { kind: "separator" }, single("vcs.log.resetToHere", { icon: "revert" }), { kind: "action", action: "vcs.log.revert", arg: many ? selection : c, icon: null, disabled: cannotApply },