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 <[email protected]>
Цей коміт міститься в:
Alexanderтаformiat authored and GitHub committed 2026-11-26 02:31:45 +08:00
1 джерело 5aeadcc888
коміт b8b245da5f
2 files changed
+12

No files matched your search

+11
Переглянути файл
@@ -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));
+1
Переглянути файл
@@ -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 },