aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-01-09 16:03:37 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-01-09 16:35:27 +0100
commit4d46f9a479e5f607968f083addb6cc0a2031d8a6 (patch)
tree5c26dcb0d0d6a3164a98aefa901b952a6131f7e2
parenta6c52263888c2ac5e9c267ec8f1d77664649536e (diff)
pkg/vcs: allow sso protocol for git repos
-rw-r--r--pkg/vcs/vcs.go4
-rw-r--r--pkg/vcs/vcs_test.go5
2 files changed, 5 insertions, 4 deletions
diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go
index 8e12bbca9..55273f4aa 100644
--- a/pkg/vcs/vcs.go
+++ b/pkg/vcs/vcs.go
@@ -261,9 +261,9 @@ var (
// nolint: lll
gitLocalRepoRe = regexp.MustCompile(`^file:///[a-zA-Z0-9-_./~]+(/)?$`)
// nolint: lll
- gitRemoteRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps)://[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)+(:[0-9]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`)
+ gitRemoteRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps|sso)://[a-zA-Z0-9-_.]+(:[0-9]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`)
// nolint: lll
- gitSSHRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps)@[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)+(:[a-zA-Z0-9-_]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`)
+ gitSSHRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps|sso)@[a-zA-Z0-9-_.]+(:[a-zA-Z0-9-_]+)?(/[a-zA-Z0-9-_./~]+)?(/)?$`)
gitBranchRe = regexp.MustCompile("^[a-zA-Z0-9-_/.]{2,200}$")
gitHashRe = regexp.MustCompile("^[a-f0-9]{8,40}$")
releaseTagRe = regexp.MustCompile(`^v([0-9]+).([0-9]+)(?:-rc([0-9]+))?(?:\.([0-9]+))?$`)
diff --git a/pkg/vcs/vcs_test.go b/pkg/vcs/vcs_test.go
index 23cfa1766..de5fbbef2 100644
--- a/pkg/vcs/vcs_test.go
+++ b/pkg/vcs/vcs_test.go
@@ -39,14 +39,15 @@ func TestCheckRepoAddress(t *testing.T) {
"https://fuchsia.googlesource.com": true,
"git@my-github.com:my/fd.git": true,
"file:///repo/linux.git": true,
+ "git://kernel/ubuntu.git": true,
+ "git@my-github/fd.git": true,
+ "sso://server/repo": true,
"git@my-github.com:/fd.git": false,
"gitgit@my-github:/fd.git": false,
- "git@my-github/fd.git": false,
"": false,
"foobar": false,
"linux-next": false,
"foo://kernel.ubuntu.com/ubuntu/ubuntu-zesty.git": false,
- "git://kernel/ubuntu.git": false,
"gitgit://kernel.ubuntu.com/ubuntu/ubuntu-zesty.git": false,
})
}