aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-30 13:35:51 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-30 18:52:59 +0100
commit0ce74b07dd1c95704c4c54626759ea869fa70abe (patch)
tree88934be789648dcace516c718e4f669406114e70 /pkg
parentecb8c01223e441fc53045b5a3ce306442b5f0b20 (diff)
pkg/vcs: allow ~ in git repo URLs
Diffstat (limited to 'pkg')
-rw-r--r--pkg/vcs/vcs.go6
-rw-r--r--pkg/vcs/vcs_test.go1
2 files changed, 4 insertions, 3 deletions
diff --git a/pkg/vcs/vcs.go b/pkg/vcs/vcs.go
index d86e15f62..8e12bbca9 100644
--- a/pkg/vcs/vcs.go
+++ b/pkg/vcs/vcs.go
@@ -259,11 +259,11 @@ func runSandboxed(dir, command string, args ...string) ([]byte, error) {
var (
// nolint: lll
- gitLocalRepoRe = regexp.MustCompile(`^file:///[a-zA-Z0-9-_./]+(/)?$`)
+ 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)://[a-zA-Z0-9-_]+(\.[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)@[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]+)(?:-rc([0-9]+))?(?:\.([0-9]+))?$`)
diff --git a/pkg/vcs/vcs_test.go b/pkg/vcs/vcs_test.go
index 5900ca046..23cfa1766 100644
--- a/pkg/vcs/vcs_test.go
+++ b/pkg/vcs/vcs_test.go
@@ -33,6 +33,7 @@ func TestCheckRepoAddress(t *testing.T) {
"git://git.cmpxchg.org/linux-mmots.git": true,
"https://anonscm.debian.org/git/kernel/linux.git": true,
"git://kernel.ubuntu.com/ubuntu/ubuntu-zesty.git": true,
+ "git://git.armlinux.org.uk/~rmk/linux-arm.git": true,
"http://host.xz:123/path/to/repo.git/": true,
"https://chromium.googlesource.com/chromiumos/third_party/kernel": true,
"https://fuchsia.googlesource.com": true,