Skip to content

Commit

Permalink
go/vcs: allow go get on github.com/ import paths with Unicode letters
Browse files Browse the repository at this point in the history
Manually apply same change as CL 41822 did for cmd/go/internal/get,
but for golang.org/x/tools/go/vcs, to help keep them in sync.

Updates golang/go#18660.
Helps golang/go#11490.

Change-Id: I6c7759c073583dea771bc438b70f8c2eb7b5ebfb
Reviewed-on: https://go-review.googlesource.com/42017
Reviewed-by: Brad Fitzpatrick <[email protected]>
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
dmitshur authored and bradfitz committed Apr 28, 2017
1 parent b6d1a16 commit 2382e39
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ var vcsPaths = []*vcsPath{
// Github
{
prefix: "github.com/",
re: `^(?P<root>github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`,
re: `^(?P<root>github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`,
vcs: "git",
repo: "https://{root}",
check: noVCSSuffix,
Expand Down
12 changes: 10 additions & 2 deletions go/vcs/vcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,25 @@ func TestRepoRootForImportPath(t *testing.T) {
Repo: "https://github.com/golang/groupcache",
},
},
// Unicode letters in directories (issue 18660).
{
"github.com/user/unicode/испытание",
&RepoRoot{
VCS: vcsGit,
Repo: "https://github.com/user/unicode",
},
},
}

for _, test := range tests {
got, err := RepoRootForImportPath(test.path, false)
if err != nil {
t.Errorf("RepoRootForImport(%q): %v", test.path, err)
t.Errorf("RepoRootForImportPath(%q): %v", test.path, err)
continue
}
want := test.want
if got.VCS.Name != want.VCS.Name || got.Repo != want.Repo {
t.Errorf("RepoRootForImport(%q) = VCS(%s) Repo(%s), want VCS(%s) Repo(%s)", test.path, got.VCS, got.Repo, want.VCS, want.Repo)
t.Errorf("RepoRootForImportPath(%q) = VCS(%s) Repo(%s), want VCS(%s) Repo(%s)", test.path, got.VCS, got.Repo, want.VCS, want.Repo)
}
}
}
Expand Down

0 comments on commit 2382e39

Please sign in to comment.