1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-10 04:07:18 +02:00

handle ssh protocol

This commit is contained in:
Jesse Duffield 2021-12-26 17:01:06 +11:00
parent d9db5ccfbe
commit 4df003cc44
2 changed files with 11 additions and 2 deletions

View File

@ -12,8 +12,8 @@ import (
// if you want to make a custom regex for a given service feel free to test it out
// at regoio.herokuapp.com
var defaultUrlRegexStrings = []string{
`^https?://.*/(?P<owner>.*)/(?P<repo>.*?)(\.git)?$`,
`^git@.*:(?P<owner>.*)/(?P<repo>.*?)(\.git)?$`,
`^(?:https?|ssh)://.*/(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
`^git@.*:(?P<owner>.*)/(?P<repo>.*?)(?:\.git)?$`,
}
// Service is a service that repository is on (Github, Bitbucket, ...)

View File

@ -34,6 +34,15 @@ func TestGetRepoInfoFromURL(t *testing.T) {
assert.EqualValues(t, repoInfo.Repository, "super_calculator")
},
},
{
NewGithubService("github.com", "github.com"),
"Returns repository information for ssh remote url",
"ssh://git@github.com/petersmith/super_calculator",
func(repoInfo *RepoInformation) {
assert.EqualValues(t, repoInfo.Owner, "petersmith")
assert.EqualValues(t, repoInfo.Repository, "super_calculator")
},
},
{
NewGithubService("github.com", "github.com"),
"Returns repository information for http remote url",