]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: support git.apache.org Git repos
authorKonstantin Shaposhnikov <k.shaposhnikov@gmail.com>
Thu, 14 May 2015 16:53:10 +0000 (00:53 +0800)
committerRuss Cox <rsc@golang.org>
Wed, 22 Jul 2015 19:50:08 +0000 (19:50 +0000)
This change fixes resolution of secure (https) repo URL for
git.apache.org Git repositories.

E.g. the correct repo URL for git.apache.org/thrift.git/lib/go/thrift is
https://git.apache.org/thrift.git, not https://git.apache.org/thrift

Fixes #10797

Change-Id: I67d5312ad8620eb780e42c2e002c8f286f60645a
Reviewed-on: https://go-review.googlesource.com/10092
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/go/vcs.go
src/cmd/go/vcs_test.go

index 64cbf45a74c08adabfc70084563e5f3b7aeaec78..8871f77371c0217b6090057567cee1bc7556ec21 100644 (file)
@@ -882,6 +882,14 @@ var vcsPaths = []*vcsPath{
                check:  noVCSSuffix,
        },
 
+       // Git at Apache
+       {
+               prefix: "git.apache.org",
+               re:     `^(?P<root>git.apache.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`,
+               vcs:    "git",
+               repo:   "https://{root}",
+       },
+
        // General syntax for any server.
        {
                re:   `^(?P<root>(?P<repo>([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?/[A-Za-z0-9_.\-/]*?)\.(?P<vcs>bzr|git|hg|svn))(/[A-Za-z0-9_.\-]+)*$`,
index 44f7ea8418bec0d6fda9aecbec881bc3a0f9dd48..f5d5e4f4f0b521a5ccbe99b5039a0ee95965fd7b 100644 (file)
@@ -96,6 +96,30 @@ func TestRepoRootForImportPath(t *testing.T) {
                        "hub.jazz.net/git/USER/pkgname",
                        nil,
                },
+               // Spaces are not valid in package name
+               {
+                       "git.apache.org/package name/path/to/lib",
+                       nil,
+               },
+               // Should have ".git" suffix
+               {
+                       "git.apache.org/package-name/path/to/lib",
+                       nil,
+               },
+               {
+                       "git.apache.org/package-name.git",
+                       &repoRoot{
+                               vcs:  vcsGit,
+                               repo: "https://git.apache.org/package-name.git",
+                       },
+               },
+               {
+                       "git.apache.org/package-name_2.x.git/path/to/lib",
+                       &repoRoot{
+                               vcs:  vcsGit,
+                               repo: "https://git.apache.org/package-name_2.x.git",
+                       },
+               },
        }
 
        for _, test := range tests {