diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-04-13 21:15:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-13 21:15:58 +1000 |
commit | caedf574845513d96f30252535941b6de9351308 (patch) | |
tree | dd57d25f9c1a7626595a67c84718d019ceb070f0 | |
parent | 95757ceb3bb85054ae05abceaef70c6aa83035fb (diff) | |
parent | 298dae23e8395712a6644d860b9aa983477fcc33 (diff) |
Merge pull request #2539 from axieax/ssh-git-url-parsing-fix
-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", |