mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-12 06:50:31 +00:00
pkg/vcs: Support ssh git repos
Signed-off-by: Jukka Kaartinen <jukka.kaartinen@unikie.com>
This commit is contained in:
parent
84da034b1e
commit
ef26b61025
@ -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]+))?$`)
|
||||
|
@ -33,6 +33,10 @@ func TestCheckRepoAddress(t *testing.T) {
|
||||
"http://host.xz:123/path/to/repo.git/": true,
|
||||
"https://chromium.googlesource.com/chromiumos/third_party/kernel": true,
|
||||
"https://fuchsia.googlesource.com": true,
|
||||
"git@my-github.com:my/fd.git": 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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user