mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-24 05:36:19 +02:00
fix: generalize parsing of ssh git urls
This commit is contained in:
parent
a02b54e1b7
commit
298dae23e8
@ -4,7 +4,7 @@ package hosting_service
|
|||||||
// at regoio.herokuapp.com
|
// at regoio.herokuapp.com
|
||||||
var defaultUrlRegexStrings = []string{
|
var defaultUrlRegexStrings = []string{
|
||||||
`^(?:https?|ssh)://[^/]+/(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^(?:https?|ssh)://[^/]+/(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
`^git@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
`^.*?@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
}
|
}
|
||||||
var defaultRepoURLTemplate = "https://{{.webDomain}}/{{.owner}}/{{.repo}}"
|
var defaultRepoURLTemplate = "https://{{.webDomain}}/{{.owner}}/{{.repo}}"
|
||||||
|
|
||||||
|
@ -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)
|
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",
|
testName: "Opens a link to new pull request on github with https remote url with specific target branch",
|
||||||
from: "feature/sum-operation",
|
from: "feature/sum-operation",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user