fix(shared): detect Azure DevOps SSH remotes (ssh.dev.azure.com) (#6187)
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
1 parent
6befe42eb0
commit
220e573b14
2 files changed
+25
-1
No files matched your search
@@ -57,6 +57,22 @@ describe("detectSourceControlProviderFromRemoteUrl", () => {
|
||||
).toBe("bitbucket");
|
||||
});
|
||||
|
||||
it("detects Azure DevOps SSH remotes", () => {
|
||||
// The default Azure DevOps SSH clone URL uses the ssh.dev.azure.com host.
|
||||
expect(
|
||||
detectSourceControlProviderFromRemoteUrl("[email protected]:v3/org/project/repo")?.kind,
|
||||
).toBe("azure-devops");
|
||||
expect(
|
||||
detectSourceControlProviderFromRemoteUrl("ssh://[email protected]:22/v3/org/project/repo")
|
||||
?.kind,
|
||||
).toBe("azure-devops");
|
||||
// Legacy visualstudio.com SSH host stays classified too.
|
||||
expect(
|
||||
detectSourceControlProviderFromRemoteUrl("[email protected]:v3/org/project/repo")
|
||||
?.kind,
|
||||
).toBe("azure-devops");
|
||||
});
|
||||
|
||||
it("preserves ports while classifying by hostname", () => {
|
||||
expect(
|
||||
detectSourceControlProviderFromRemoteUrl("https://gitlab.com:8443/group/repo.git"),
|
||||
|
||||
@@ -176,7 +176,15 @@ function isGitLabHost(host: string): boolean {
|
||||
}
|
||||
|
||||
function isAzureDevOpsHost(host: string): boolean {
|
||||
return host === "dev.azure.com" || host.endsWith(".visualstudio.com");
|
||||
// `ssh.dev.azure.com` is the default Azure DevOps SSH clone host
|
||||
// ([email protected]:v3/org/project/repo), so match any `*.dev.azure.com`
|
||||
// subdomain, not just the bare `dev.azure.com`. Legacy hosts stay under
|
||||
// `.visualstudio.com` (including `vs-ssh.visualstudio.com`).
|
||||
return (
|
||||
host === "dev.azure.com" ||
|
||||
host.endsWith(".dev.azure.com") ||
|
||||
host.endsWith(".visualstudio.com")
|
||||
);
|
||||
}
|
||||
|
||||
function isBitbucketHost(host: string): boolean {
|
||||
|
||||
Reference in new issue
Block a user