mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-12 11:15:00 +02:00
Merge pull request #2132 from jtraub/fix-open-gitlab-commit
This commit is contained in:
commit
e7aacafc2e
@ -3,7 +3,7 @@ package hosting_service
|
|||||||
// if you want to make a custom regex for a given service feel free to test it out
|
// if you want to make a custom regex for a given service feel free to test it out
|
||||||
// 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)?$`,
|
`^git@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
|
||||||
}
|
}
|
||||||
var defaultRepoURLTemplate = "https://{{.webDomain}}/{{.owner}}/{{.repo}}"
|
var defaultRepoURLTemplate = "https://{{.webDomain}}/{{.owner}}/{{.repo}}"
|
||||||
|
@ -47,6 +47,15 @@ func TestGetPullRequestURL(t *testing.T) {
|
|||||||
assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Fsum-operation?expand=1", url)
|
assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Fsum-operation?expand=1", url)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
testName: "Opens a link to new pull request on github with https remote url",
|
||||||
|
from: "feature/sum-operation",
|
||||||
|
remoteUrl: "https://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%2Fsum-operation?expand=1", url)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
testName: "Opens a link to new pull request on bitbucket with specific target branch",
|
testName: "Opens a link to new pull request on bitbucket with specific target branch",
|
||||||
from: "feature/profile-page/avatar",
|
from: "feature/profile-page/avatar",
|
||||||
@ -77,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 https remote url with specific target branch",
|
||||||
|
from: "feature/sum-operation",
|
||||||
|
to: "feature/operations",
|
||||||
|
remoteUrl: "https://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 gitlab",
|
testName: "Opens a link to new pull request on gitlab",
|
||||||
from: "feature/ui",
|
from: "feature/ui",
|
||||||
@ -95,6 +114,15 @@ func TestGetPullRequestURL(t *testing.T) {
|
|||||||
assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fui", url)
|
assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fui", url)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
testName: "Opens a link to new pull request on gitlab with https remote url in nested groups",
|
||||||
|
from: "feature/ui",
|
||||||
|
remoteUrl: "https://gitlab.com/peter/public/calculator.git",
|
||||||
|
test: func(url string, err error) {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fui", url)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
testName: "Opens a link to new pull request on gitlab with specific target branch",
|
testName: "Opens a link to new pull request on gitlab with specific target branch",
|
||||||
from: "feature/commit-ui",
|
from: "feature/commit-ui",
|
||||||
@ -115,6 +143,16 @@ func TestGetPullRequestURL(t *testing.T) {
|
|||||||
assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fcommit-ui&merge_request[target_branch]=epic%2Fui", url)
|
assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fcommit-ui&merge_request[target_branch]=epic%2Fui", url)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
testName: "Opens a link to new pull request on gitlab with https remote url with specific target branch in nested groups",
|
||||||
|
from: "feature/commit-ui",
|
||||||
|
to: "epic/ui",
|
||||||
|
remoteUrl: "https://gitlab.com/peter/public/calculator.git",
|
||||||
|
test: func(url string, err error) {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fcommit-ui&merge_request[target_branch]=epic%2Fui", url)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
testName: "Opens a link to new pull request on bitbucket with a custom SSH username",
|
testName: "Opens a link to new pull request on bitbucket with a custom SSH username",
|
||||||
from: "feature/profile-page",
|
from: "feature/profile-page",
|
||||||
|
Loading…
Reference in New Issue
Block a user