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.0
Permissions in 0.3.0
Files
github.test.ts1.9 KB
// The upstream's remote, whether it is on GitHub, and what gh prints.
import assert from "node:assert/strict";
import { test } from "node:test";
import { createdPull, onGitHub, PullList, upstreamRemote } from "./github.ts";
const remotes = [
"origin\tgit@github.com:me/repo.git (fetch)",
"origin\tgit@github.com:me/repo.git (push)",
"team/fork\thttps://github.com/team/repo.git (fetch)",
"team\thttps://gitlab.com/team/repo.git (fetch)",
"",
].join("\n");
test("the upstream's remote is the longest remote name it starts with, with its fetch URL", () => {
assert.deepEqual(upstreamRemote("origin/feature/x", remotes), {
name: "origin",
url: "git@github.com:me/repo.git",
branch: "feature/x",
});
assert.deepEqual(upstreamRemote("team/fork/main", remotes), {
name: "team/fork",
url: "https://github.com/team/repo.git",
branch: "main",
});
assert.equal(upstreamRemote("elsewhere/main", remotes), null);
});
test("GitHub remotes are recognized in URL, scp and SSH alias forms, and others are not", () => {
for (const url of [
"https://github.com/o/r.git",
"https://token@github.com/o/r",
"ssh://git@github.com/o/r.git",
"git@github.com:o/r.git",
"github-work:o/r.git",
"https://github.example.com/o/r.git",
])
assert.equal(onGitHub(url), true, url);
for (const url of ["https://gitlab.com/o/r.git", "git@bitbucket.org:o/r.git", "/srv/git/repo.git", "../repo"])
assert.equal(onGitHub(url), false, url);
});
test("gh's pull request output gives the link and number", () => {
assert.deepEqual(createdPull("Creating pull request for feature into main\n\nhttps://github.com/o/r/pull/42\n"), {
url: "https://github.com/o/r/pull/42",
number: 42,
});
assert.equal(createdPull("nothing here"), null);
assert.deepEqual(PullList.parse([{ url: "https://github.com/o/r/pull/7", number: 7 }]), [
{ url: "https://github.com/o/r/pull/7", number: 7 },
]);
});
No comments yet.