Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(source-control): forge SSH hosts key to their web host's repository #34937

Openjuliusmarmingewants to merge 2 commits intomain fromrefs/pull/34937/headopened View on GitHub

Showing 5 changed files with 12 additions and 0 deletions (loading 2).

x
0 of 5 viewed, 5 left
2 additions and 0 deletionspackages/client-runtime/src/sourceControlClients.test.tsModified
View file
@@ -302,6 +302,8 @@
it.each([
["git@github.com:T3Tools/T3Code.git", "github.com/t3tools/t3code"],
["ssh://git@gitlab.company.com:2222/team/project.git", "gitlab.company.com/team/project"],
+ ["ssh://git@ssh.github.com:443/T3Tools/T3Code.git", "github.com/t3tools/t3code"],
+ ["git@ssh.bitbucket.org:Workspace/Repo.git", "bitbucket.org/workspace/repo"],
"git@ssh.dev.azure.com:v3/T3Tools/Platform/T3Code",
"dev.azure.com/t3tools/platform/_git/t3code",
6 additions and 0 deletionspackages/source-control-bitbucket/src/shared/definition.tsModified
View file
@@ -27,6 +27,7 @@
const REPOSITORY_PAGE_PATH = /^\/([^/]+\/[^/]+)\/src\/[^/]/u;
​
const KIND = SourceControlProviderKind.make("bitbucket");
+const BITBUCKET_SSH_HOSTS = ["ssh.bitbucket.org", "altssh.bitbucket.org"];
​
function isBitbucketHost(hostname: string): boolean {
const host = hostname.toLowerCase();
@@ -131,6 +132,11 @@
baseUrl: `https://${host}`,
: null,
+ // Bitbucket's SSH hosts serve bitbucket.org's repositories.
+ repositoryKeyFromRemote: (key) =>
+ BITBUCKET_SSH_HOSTS.some((host) => key.startsWith(`${host}/`))
+ ? `bitbucket.org${key.slice(key.indexOf("/"))}`