diff options
-rw-r--r-- | pkg/commands/hosting_service/definitions.go | 2 | ||||
-rw-r--r-- | pkg/commands/hosting_service/hosting_service_test.go | 10 |
2 files changed, 11 insertions, 1 deletions
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<owner>.*)/(?P<repo>.*?)(?:\.git)?$`, - `^git@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`, + `^.*?@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.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 @@ -87,6 +87,16 @@ func TestGetPullRequestURL(t *testing.T) { }, }, { + 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", to: "feature/operations", |