The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 13:15 UTC
fix(gitlab): accept merge request URLs from self-hosted hosts (#23848)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
Victor Vogel committed
Oct 29, 2026 at 12:43 UTC
505d02282fc5ff398797df88be8a4160e56da412
3 files changed
+30
-1
packages/client-runtime/src/pullRequestLinkInput.test.ts
+7
@@ -161,6 +161,13 @@ describe("parsePullRequestReference", () => {
161
).toBe("https://acme.visualstudio.com/project/_git/t3code/pullrequest/42");
162
});
163
164
+ it.each([
165
+ "https://code.example.com/group/project/-/merge_requests/42",
166
+ "http://git.internal/group/sub/project/-/merge_requests/7",
167
+ ])("accepts self-hosted GitLab merge request URL %s", (url) => {
168
+ expect(parsePullRequestReference(url)).toBe(url);
169
+ });
170
+
171
it("accepts gh pr checkout commands with raw numbers", () => {
172
expect(parsePullRequestReference("gh pr checkout 42")).toBe("42");
173
});
packages/source-control-gitlab/src/shared/definition.test.ts
+22
@@ -31,6 +31,28 @@ describe("GitLab change request URLs", () => {
31
expect(parse("https://gitlab.com/t3code/-/merge_requests/12")).toBeNull();
32
});
33
34
+ it("recognizes only merge request URLs it can parse", () => {
35
+ for (const url of [
36
+ "https://gitlab.com/g/p?x=/-/merge_requests/5",
37
+ "https://gitlab.com/g/p#/-/merge_requests/5",
38
+ "https://gitlab.com?x=/g/p/-/merge_requests/5",
39
+ "https://gitlab.com#/g/p/-/merge_requests/5",
40
+ "https://gitlab.com/t3code/-/merge_requests/12",
41
+ "https://gitlab.com/g//-/merge_requests/5",
42
+ ]) {
43
+ expect(definition.isChangeRequestReference(url), url).toBe(false);
44
+ expect(parse(url), url).toBeNull();
45
+ }
46
+ for (const url of [
47
+ "https://code.acme.test/a/b/c/-/merge_requests/7?tab=diffs",
48
+ "http://git.internal/a/b/c/-/merge_requests/7#note_1",
49
+ "https://code.acme.test/a/b/c/-/merge_requests/7/diffs",
50
+ ]) {
51
+ expect(definition.isChangeRequestReference(url), url).toBe(true);
52
+ expect(parse(url), url).toMatchObject({ repository: "a/b/c", number: 7 });
53
+ }
54
+ });
55
+
56
it("builds merge request URLs below the repository", () => {
57
expect(
58
definition.changeRequestUrl({
packages/source-control-gitlab/src/shared/definition.ts
+1
-1
@@ -11,7 +11,7 @@ import { icon } from "./icon.ts";
11
12
const CHECKOUT_COMMAND = /^glab\s+mr\s+checkout\s+(.+)$/i;
13
const CHANGE_REQUEST_REFERENCE =
14
- /^https:\/\/[^/\s]*gitlab[^/\s]*\/.+\/-\/merge_requests\/(\d+)(?:[/?#].*)?$/i;
14
+ /^https?:\/\/[^/?#\s]+\/[^/?#\s]+(?:\/[^/?#\s]+)+\/-\/merge_requests\/(\d+)(?:[/?#].*)?$/i;
15
16
// Self-managed GitLab runs on any hostname and nests projects in groups.
17
const CHANGE_REQUEST_PATH = /^\/([^/]+(?:\/[^/]+)+)\/-\/merge_requests\/(\d+)(?:\/|$)/u;