From 8276d4a50a686dd479fb96bf98bdfd8ec3077171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=9A=80=20Niklas=20Arens?= Date: Wed, 13 Aug 2025 20:05:52 +0200 Subject: [PATCH 1/2] test: TDD - support Azure DevOps vs-ssh.visualstudio.com SSH remotes --- .../hosting_service/hosting_service_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/commands/hosting_service/hosting_service_test.go b/pkg/commands/hosting_service/hosting_service_test.go index 2278d46d2..f3504834b 100644 --- a/pkg/commands/hosting_service/hosting_service_test.go +++ b/pkg/commands/hosting_service/hosting_service_test.go @@ -223,6 +223,22 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://mycompany.azuredevops.com/collection/myproject/_git/myrepo/pullrequestcreate?sourceRef=feature%2Fnew", url) }, }, + { + testName: "Opens a link to new pull request on Azure DevOps (legacy vs-ssh.visualstudio.com SSH) with mapping to dev.azure.com", + from: "feature/new", + remoteUrl: "git@vs-ssh.visualstudio.com:v3/myorg/myproject/myrepo", + configServiceDomains: map[string]string{ + "vs-ssh.visualstudio.com": "azuredevops:dev.azure.com", + }, + test: func(url string, err error) { + /* EXPECTED: + assert.NoError(t, err) + assert.Equal(t, "https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequestcreate?sourceRef=feature%2Fnew", url) + ACTUAL: */ + assert.Error(t, err) + assert.Equal(t, "", url) + }, + }, { testName: "Opens a link to new pull request on Bitbucket Server (SSH)", from: "feature/new", From a44af0685c82e4e0d34775e81fc3ee5e8c3893f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=9A=80=20Niklas=20Arens?= Date: Wed, 13 Aug 2025 19:59:50 +0200 Subject: [PATCH 2/2] fix(hosting_service): support Azure DevOps vs-ssh.visualstudio.com SSH remotes --- pkg/commands/hosting_service/definitions.go | 1 + pkg/commands/hosting_service/hosting_service_test.go | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/commands/hosting_service/definitions.go b/pkg/commands/hosting_service/definitions.go index a192bbbe6..bd82d99a5 100644 --- a/pkg/commands/hosting_service/definitions.go +++ b/pkg/commands/hosting_service/definitions.go @@ -46,6 +46,7 @@ var azdoServiceDef = ServiceDefinition{ pullRequestURLIntoTargetBranch: "/pullrequestcreate?sourceRef={{.From}}&targetRef={{.To}}", commitURL: "/commit/{{.CommitHash}}", regexStrings: []string{ + `^.+@vs-ssh\.visualstudio\.com[:/](?:v3/)?(?P[^/]+)/(?P[^/]+)/(?P[^/]+?)(?:\.git)?$`, `^git@ssh.dev.azure.com.*/(?P.*)/(?P.*)/(?P.*?)(?:\.git)?$`, `^https://.*@dev.azure.com/(?P.*?)/(?P.*?)/_git/(?P.*?)(?:\.git)?$`, `^https://.*/(?P.*?)/(?P.*?)/_git/(?P.*?)(?:\.git)?$`, diff --git a/pkg/commands/hosting_service/hosting_service_test.go b/pkg/commands/hosting_service/hosting_service_test.go index f3504834b..bcf5e6fb4 100644 --- a/pkg/commands/hosting_service/hosting_service_test.go +++ b/pkg/commands/hosting_service/hosting_service_test.go @@ -231,12 +231,8 @@ func TestGetPullRequestURL(t *testing.T) { "vs-ssh.visualstudio.com": "azuredevops:dev.azure.com", }, test: func(url string, err error) { - /* EXPECTED: assert.NoError(t, err) assert.Equal(t, "https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequestcreate?sourceRef=feature%2Fnew", url) - ACTUAL: */ - assert.Error(t, err) - assert.Equal(t, "", url) }, }, {