]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/get: fix regexes for "any" character matching
authorPiyush Mishra <piyush@codeitout.com>
Fri, 9 Feb 2018 03:32:17 +0000 (03:32 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 13 Feb 2018 19:47:48 +0000 (19:47 +0000)
Minor bug: `hubajazz.net` and `gitbapache.org` would match, probably shouldn't

GitHub-Last-Rev: 75bd338569ca41f83b9c36fe3d5ae3b4db0a26cc
GitHub-Pull-Request: golang/go#23755
Change-Id: Ie9c9ab1c15364eccdab8cf3b106b9c370e7f532f
Reviewed-on: https://go-review.googlesource.com/92997
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/go/internal/get/vcs.go
src/cmd/go/internal/get/vcs_test.go

index 26693b13a93d82d1ceaa4c586d857d373b06d2e7..ee6b16a1369fd24224cf04345564fa03b61a33e2 100644 (file)
@@ -971,7 +971,7 @@ var vcsPaths = []*vcsPath{
        // IBM DevOps Services (JazzHub)
        {
                prefix: "hub.jazz.net/git/",
-               re:     `^(?P<root>hub.jazz.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`,
+               re:     `^(?P<root>hub\.jazz\.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`,
                vcs:    "git",
                repo:   "https://{root}",
                check:  noVCSSuffix,
@@ -980,7 +980,7 @@ var vcsPaths = []*vcsPath{
        // Git at Apache
        {
                prefix: "git.apache.org/",
-               re:     `^(?P<root>git.apache.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`,
+               re:     `^(?P<root>git\.apache\.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`,
                vcs:    "git",
                repo:   "https://{root}",
        },
index e29338aec19464e460a048ef91e03b414474eb95..2cb611fabd8672af4cf79df70b77aa62a17004ce 100644 (file)
@@ -59,6 +59,10 @@ func TestRepoRootForImportPath(t *testing.T) {
                        "hub.jazz.net",
                        nil,
                },
+               {
+                       "hubajazz.net",
+                       nil,
+               },
                {
                        "hub2.jazz.net",
                        nil,
@@ -140,6 +144,10 @@ func TestRepoRootForImportPath(t *testing.T) {
                        "git.apache.org/package-name/path/to/lib",
                        nil,
                },
+               {
+                       "gitbapache.org",
+                       nil,
+               },
                {
                        "git.apache.org/package-name.git",
                        &repoRoot{