зеркало из https://github.com/mislav/hub.git
Fixed gh clone to stop when it finds a URL that is formatted like a repository one
This commit is contained in:
Родитель
ab686c68c6
Коммит
a395b03ae3
|
@ -41,11 +41,19 @@ func transformCloneArgs(args *Args) {
|
|||
isSSH := parseClonePrivateFlag(args)
|
||||
hasValueRegxp := regexp.MustCompile("^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$")
|
||||
nameWithOwnerRegexp := regexp.MustCompile(NameWithOwnerRe)
|
||||
|
||||
httpReadOnlyRegexp := regexp.MustCompile("(https|git)://github\\.com/(.+)/(.+?)(\\.git|$)")
|
||||
sshRegexp := regexp.MustCompile("git@github\\.com:(.+)/(.+?)(\\.git|$)")
|
||||
|
||||
for i, a := range args.Params {
|
||||
if hasValueRegxp.MatchString(a) {
|
||||
continue
|
||||
}
|
||||
|
||||
if httpReadOnlyRegexp.MatchString(a) || sshRegexp.MatchString(a) {
|
||||
break
|
||||
}
|
||||
|
||||
if nameWithOwnerRegexp.MatchString(a) && !isDir(a) {
|
||||
name, owner := parseCloneNameAndOwner(a)
|
||||
config := github.CurrentConfig()
|
||||
|
|
Загрузка…
Ссылка в новой задаче