diff --git a/pkg/commands/hosting_service/definitions.go b/pkg/commands/hosting_service/definitions.go index ff872cd8c05..d3f8f2bb883 100644 --- a/pkg/commands/hosting_service/definitions.go +++ b/pkg/commands/hosting_service/definitions.go @@ -48,6 +48,7 @@ var azdoServiceDef = ServiceDefinition{ regexStrings: []string{ `^git@ssh.dev.azure.com.*/(?P.*)/(?P.*)/(?P.*?)(?:\.git)?$`, `^https://.*@dev.azure.com/(?P.*?)/(?P.*?)/_git/(?P.*?)(?:\.git)?$`, + `^https://.*/(?P.*?)/(?P.*?)/_git/(?P.*?)(?:\.git)?$`, }, repoURLTemplate: "https://{{.webDomain}}/{{.org}}/{{.project}}/_git/{{.repo}}", } diff --git a/pkg/commands/hosting_service/hosting_service_test.go b/pkg/commands/hosting_service/hosting_service_test.go index 4ce847bf76c..d01ca37688b 100644 --- a/pkg/commands/hosting_service/hosting_service_test.go +++ b/pkg/commands/hosting_service/hosting_service_test.go @@ -210,6 +210,19 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequestcreate?sourceRef=feature%2Fnew&targetRef=dev", url) }, }, + { + testName: "Opens a link to new pull request on Azure DevOps Server (HTTP)", + from: "feature/new", + remoteUrl: "https://mycompany.azuredevops.com/collection/myproject/_git/myrepo", + configServiceDomains: map[string]string{ + // valid configuration for a azure devops server URL + "mycompany.azuredevops.com": "azuredevops:mycompany.azuredevops.com", + }, + test: func(url string, err error) { + assert.NoError(t, err) + 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 Bitbucket Server (SSH)", from: "feature/new",