дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
Right-clicking a line or the line numbers of a diff pane now offers Annotate with Git Blame / Close Annotations. Each side is blamed on its own history: a revision on that revision (at the path the file had there), the index on HEAD with its own text, and the working file like the editor's annotations, refreshed after edits and when HEAD moves. Compare Files, Local History and plain-text sides don't offer it. The divider between the panes, which had no menu, acts on the pane focused last. Fixes #1443
34 рядки
1.2 KiB
TypeScript
34 рядки
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { diffBlameTarget } from "./diffBlame";
|
|
|
|
describe("diffBlameTarget", () => {
|
|
it("blames a revision on its own history, at the path it had there", () => {
|
|
expect(diffBlameTarget({ type: "rev", rev: "abc123^" }, "/p/A.java", true)).toEqual({
|
|
path: "/p/A.java",
|
|
revision: "abc123^",
|
|
});
|
|
expect(diffBlameTarget({ type: "rev", rev: "abc123", path: "/p/Old.java" }, "/p/A.java", true)).toEqual({
|
|
path: "/p/Old.java",
|
|
revision: "abc123",
|
|
});
|
|
});
|
|
|
|
it("blames the index on HEAD and the working file like the editor", () => {
|
|
expect(diffBlameTarget({ type: "rev", rev: ":0" }, "/p/A.java", true)).toEqual({
|
|
path: "/p/A.java",
|
|
revision: "HEAD",
|
|
});
|
|
expect(diffBlameTarget({ type: "worktree" }, "/p/A.java", true)).toEqual({ path: "/p/A.java" });
|
|
});
|
|
|
|
it("offers nothing for content outside Git", () => {
|
|
for (const side of [
|
|
{ type: "file", path: "/p/B.java" },
|
|
{ type: "text", text: "x", label: "Clipboard" },
|
|
{ type: "history", id: "1", label: "Local History" },
|
|
] as const)
|
|
expect(diffBlameTarget(side, "/p/A.java", true)).toBeNull();
|
|
expect(diffBlameTarget({ type: "worktree" }, "/p/A.java", false)).toBeNull();
|
|
});
|
|
});
|