Official
git
Built-in git UI (JavaScript UI plugin).
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/git@0.3.2
Permissions in 0.3.2
Files
tabs.test.ts2.4 KB
// Git opens diffs and files through the divergence/tabs service. Real
// activation with a canned tabs client: opening calls the service, and
// without a provider the repository actions still run.
import assert from "node:assert/strict";
import { test } from "node:test";
import activate from "./main.ts";
import { fakeApi } from "./testing.ts";
test("diffs and files open through the tabs service", async () => {
const fake = fakeApi({ tabs: true });
const dispose = activate(fake.api);
try {
await fake.settle();
fake.action("changes", "src/a.ts", "file");
await fake.settle();
assert.deepEqual(fake.tabsCalls, [
{ method: "open", params: { kind: "file", workspaceId: "w1", path: "src/a.ts" } },
]);
fake.tabsCalls.length = 0;
fake.invoke("git-tree-changes", "onSelect", { id: "src/a.ts", folder: false });
await fake.settle();
assert.ok(fake.calls.some((call) => call.method === "host/git.diff"));
assert.deepEqual(fake.tabsCalls, [
{
method: "open",
params: {
kind: "diff",
workspaceId: "w1",
path: "src/a.ts",
diff: "--- a/src/a.ts\n+++ b/src/a.ts\n@@ -1 +1 @@\n-old\n+new",
staged: false,
},
},
]);
} finally {
await dispose();
}
});
test("without the tabs plugin diffs still load and nothing opens", async () => {
const fake = fakeApi({ tabs: false });
const dispose = activate(fake.api);
try {
await fake.settle();
fake.invoke("git-tree-changes", "onSelect", { id: "src/a.ts", folder: false });
await fake.settle();
assert.ok(fake.calls.some((call) => call.method === "host/git.diff"));
assert.deepEqual(fake.tabsCalls, []);
assert.equal(fake.state().shared?.openTab, undefined);
} finally {
await dispose();
}
});
test("Show Source Control opens the panel with its message box holding the keyboard, and closes it again", async () => {
const fake = fakeApi({ tabs: false });
const dispose = activate(fake.api);
try {
await fake.settle();
fake.update({ shared: { rightPanel: null } });
await fake.command("git.toggle");
assert.equal(fake.state().shared?.rightPanel, "git");
assert.deepEqual(fake.focused, ["git-message"]);
await fake.command("git.toggle");
assert.equal(fake.state().shared?.rightPanel, null);
assert.deepEqual(fake.focused, ["git-message"], "closing leaves the keyboard where it is");
} finally {
await dispose();
}
});
No comments yet.