diff options
| author | Jukka Kaartinen <jukka.kaartinen@unikie.com> | 2020-04-03 12:54:47 +0300 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-04-03 15:33:08 +0200 |
| commit | ef26b61025bac4c6bb1a0ef7eccc45f43f84c841 (patch) | |
| tree | 705b09babd6606fe432ef8123d3063d52a002228 /pkg/vcs/vcs.go | |
| parent | 84da034b1ed1d69311d84e7a10f426cfb3aade7b (diff) | |
pkg/vcs: Support ssh git repos
Signed-off-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
Diffstat (limited to 'pkg/vcs/vcs.go')
| -rw-r--r-- | pkg/vcs/vcs.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go index 647a00f42..aa38be27d 100644 --- a/pkg/vcs/vcs.go +++ b/pkg/vcs/vcs.go @@ -154,7 +154,7 @@ func Patch(dir string, patch []byte) error { // CheckRepoAddress does a best-effort approximate check of a git repo address. func CheckRepoAddress(repo string) bool { - return gitRepoRe.MatchString(repo) + return gitRepoRe.MatchString(repo) || gitSshRepoRe.MatchString(repo) } // CheckBranch does a best-effort approximate check of a git branch name. @@ -183,6 +183,7 @@ func runSandboxedEnv(dir, command string, env []string, args ...string) ([]byte, var ( // nolint: lll gitRepoRe = regexp.MustCompile(`^(git|ssh|http|https|ftp|ftps)://[a-zA-Z0-9-_]+(\.[a-zA-Z0-9-_]+)+(:[0-9]+)?(/[a-zA-Z0-9-_./]+)?(/)?$`) + 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-_./]+)?(/)?$`) 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]+)(?:\.([0-9]+))?$`) |
