I mean I GUESS we can have gh repos from kr

This commit is contained in:
Sam Boyer 2016-06-24 15:16:14 -04:00
Родитель d29f373dc8
Коммит 85459396b7
2 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -33,7 +33,7 @@ var (
// This regex allowed some usernames that github currently disallows. They
// may have allowed them in the past; keeping it in case we need to revert.
//ghRegex = regexp.MustCompile(`^(?P<root>github\.com/([A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`)
ghRegex = regexp.MustCompile(`^(?P<root>github\.com/([A-Za-z0-9][-A-Za-z0-9]+[A-Za-z0-9]/[A-Za-z0-9_.\-]+))((?:/[A-Za-z0-9_.\-]+)*)$`)
ghRegex = regexp.MustCompile(`^(?P<root>github\.com/([A-Za-z0-9][-A-Za-z0-9]*[A-Za-z0-9]/[A-Za-z0-9_.\-]+))((?:/[A-Za-z0-9_.\-]+)*)$`)
gpinNewRegex = regexp.MustCompile(`^(?P<root>gopkg\.in/(?:([a-zA-Z0-9][-a-zA-Z0-9]+)/)?([a-zA-Z][-.a-zA-Z0-9]*)\.((?:v0|v[1-9][0-9]*)(?:\.0|\.[1-9][0-9]*){0,2}(-unstable)?)(?:\.git)?)((?:/[a-zA-Z0-9][-.a-zA-Z0-9]*)*)$`)
//gpinOldRegex = regexp.MustCompile(`^(?P<root>gopkg\.in/(?:([a-z0-9][-a-z0-9]+)/)?((?:v0|v[1-9][0-9]*)(?:\.0|\.[1-9][0-9]*){0,2}(-unstable)?)/([a-zA-Z][-a-zA-Z0-9]*)(?:\.git)?)((?:/[a-zA-Z][-a-zA-Z0-9]*)*)$`)
bbRegex = regexp.MustCompile(`^(?P<root>bitbucket\.org/(?P<bitname>[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))((?:/[A-Za-z0-9_.\-]+)*)$`)

Просмотреть файл

@ -365,6 +365,20 @@ func TestDeduceRemotes(t *testing.T) {
VCS: []string{"git"},
},
},
// Regression - gh does allow 2-letter usernames
{
"github.com/kr/pretty",
&remoteRepo{
Base: "github.com/kr/pretty",
RelPkg: "",
CloneURL: &url.URL{
Host: "github.com",
Path: "kr/pretty",
},
Schemes: nil,
VCS: []string{"git"},
},
},
}
for _, fix := range fixtures {