diff --git a/packages/client-runtime/src/sourceControlClients.test.ts b/packages/client-runtime/src/sourceControlClients.test.ts index 1f2cbfbc3a4d7..9ac93156147e2 100644 --- a/packages/client-runtime/src/sourceControlClients.test.ts +++ b/packages/client-runtime/src/sourceControlClients.test.ts @@ -106,6 +106,13 @@ describe("sourceControlClients.parseChangeRequestUrl", () => { repository: "team/project", number: 9, }); + const nested = "https://forge.example/acme/team/pull/123/-/merge_requests/7"; + expect(parse(nested)).toEqual({ + host: "forge.example", + repository: "acme/team/pull/123", + number: 7, + }); + expect(kindOf(nested)).toBe("gitlab"); expect( sourceControlClients.changeRequestUrlFromReferenceAutolink( "https://gitlab.com/team/apps/web/-/merge_requests/42", diff --git a/packages/source-control-definitions/src/registry.ts b/packages/source-control-definitions/src/registry.ts index 90f14961c0d57..38858598e5af7 100644 --- a/packages/source-control-definitions/src/registry.ts +++ b/packages/source-control-definitions/src/registry.ts @@ -12,7 +12,8 @@ export { canonicalizePullRequestUrl as canonicalizeGitCafePullRequestUrl } from /** * GitHub comes first as the client default for unknown hosts. GitCafe, TanStack Source and Origin - * claim URLs first: GitHub and Forgejo accept the same routes on any hostname. TanStack Source is a + * claim URLs first: GitHub and Forgejo accept the same routes on any hostname. GitLab's `/-/` routes + * claim before GitHub's, which a nested project path can also match. TanStack Source is a * private beta: every reader knows its URLs, and only a server with its flag on offers the forge. */ export const builtInSourceControlDefinitions = makeSourceControlDefinitionRegistry( @@ -32,6 +33,7 @@ export const builtInSourceControlDefinitions = makeSourceControlDefinitionRegist TanStackSource.definition.kind, CursorOrigin.definition.kind, AzureDevOps.definition.kind, + GitLab.definition.kind, ], recognizeRemotesIn: [ GitCafe.definition.kind,