forked from golang/dep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax rules for valid github usernames
The current rules for github usernames only allow for alphanumeric characters or single hyphens and they cannot begin or end with a hyphen. In the past however github username rules were less strict and we need to support these (issue sdboyer/gps#194). Using the Google BigQuery public github dataset, I've checked the usernames of all public commits against the currently defined regex in deduce.go. From these results I've concluded that usernames with multiple consecutive hyphens and usernames that end with a hyphen were allowed in the past and do exist. Fortunately these are the only exceptions I've found, there were no usernames that started with a hyphen or contained any other special characters. In addition, this change now also allows one-letter usernames.
- Loading branch information
Showing
2 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,15 +77,31 @@ var pathDeductionFixtures = map[string][]pathDeductionFixture{ | |
root: "github.com/sdboyer/gps", | ||
mb: maybeGitSource{url: mkurl("https://github.com/sdboyer/gps")}, | ||
}, | ||
{ | ||
in: "github.com/sdboyer-/gps/foo", | ||
root: "github.com/sdboyer-/gps", | ||
mb: maybeSources{ | ||
maybeGitSource{url: mkurl("https://github.com/sdboyer-/gps")}, | ||
maybeGitSource{url: mkurl("ssh://[email protected]/sdboyer-/gps")}, | ||
maybeGitSource{url: mkurl("git://github.com/sdboyer-/gps")}, | ||
maybeGitSource{url: mkurl("http://github.com/sdboyer-/gps")}, | ||
}, | ||
}, | ||
{ | ||
in: "github.com/a/gps/foo", | ||
root: "github.com/a/gps", | ||
mb: maybeSources{ | ||
maybeGitSource{url: mkurl("https://github.com/a/gps")}, | ||
maybeGitSource{url: mkurl("ssh://[email protected]/a/gps")}, | ||
maybeGitSource{url: mkurl("git://github.com/a/gps")}, | ||
maybeGitSource{url: mkurl("http://github.com/a/gps")}, | ||
}, | ||
}, | ||
// some invalid github username patterns | ||
{ | ||
in: "github.com/-sdboyer/gps/foo", | ||
rerr: errors.New("github.com/-sdboyer/gps/foo is not a valid path for a source on github.com"), | ||
}, | ||
{ | ||
in: "github.com/sdboyer-/gps/foo", | ||
rerr: errors.New("github.com/sdboyer-/gps/foo is not a valid path for a source on github.com"), | ||
}, | ||
{ | ||
in: "github.com/sdbo.yer/gps/foo", | ||
rerr: errors.New("github.com/sdbo.yer/gps/foo is not a valid path for a source on github.com"), | ||
|