diff --git a/pkg/commands/hosting_service/definitions.go b/pkg/commands/hosting_service/definitions.go index 39a554c3f..8dab166aa 100644 --- a/pkg/commands/hosting_service/definitions.go +++ b/pkg/commands/hosting_service/definitions.go @@ -4,7 +4,7 @@ package hosting_service // at regoio.herokuapp.com var defaultUrlRegexStrings = []string{ `^(?:https?|ssh)://[^/]+/(?P.*)/(?P.*?)(?:\.git)?$`, - `^git@.*:(?P.*)/(?P.*?)(?:\.git)?$`, + `^.*?@.*:(?P.*)/(?P.*?)(?:\.git)?$`, } var defaultRepoURLTemplate = "https://{{.webDomain}}/{{.owner}}/{{.repo}}" diff --git a/pkg/commands/hosting_service/hosting_service_test.go b/pkg/commands/hosting_service/hosting_service_test.go index d67d94ed8..a3b128b01 100644 --- a/pkg/commands/hosting_service/hosting_service_test.go +++ b/pkg/commands/hosting_service/hosting_service_test.go @@ -86,6 +86,16 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Foperations...feature%2Fsum-operation?expand=1", url) }, }, + { + testName: "Opens a link to new pull request on github with specific target branch (different git username)", + from: "feature/sum-operation", + to: "feature/operations", + remoteUrl: "ssh://org-12345@github.com:peter/calculator.git", + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Foperations...feature%2Fsum-operation?expand=1", url) + }, + }, { testName: "Opens a link to new pull request on github with https remote url with specific target branch", from: "feature/sum-operation",