This commit is contained in:
Matt Gaddis 2024-04-19 11:21:25 -07:00 committed by GitHub
commit 478e955bb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -34,6 +34,7 @@ func IsURL(str string) bool {
// - http://(.*).git(?:#.+)?$ same, but non-TLS
// - git://(.*) URLs using git:// scheme
// - git@(.*)
// - ssh://git@(.*)
// - github.com/ see description below
//
// The github.com/ prefix is a special case used to treat context-paths
@ -77,7 +78,7 @@ func IsGitURL(str string) bool {
if IsURL(str) && urlPathWithFragmentSuffix.MatchString(str) {
return true
}
for _, prefix := range []string{"git://", "github.com/", "git@"} {
for _, prefix := range []string{"git://", "github.com/", "git@", "ssh://"} {
if strings.HasPrefix(str, prefix) {
return true
}

View file

@ -11,6 +11,9 @@ var (
"http://github.com/docker/docker.git",
"http://github.com/docker/docker.git#branch",
"http://github.com/docker/docker.git#:dir",
"ssh://git@github.com/docker/docker.git",
"ssh://a_user@github.com/docker/docker.git",
"ssh://github.com/docker/docker.git",
}
incompleteGitUrls = []string{
"github.com/docker/docker",