mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
go back to using user/pass when cloning from github to avoid prompts for deleted repos
This commit is contained in:
@@ -3,6 +3,7 @@ package download
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -63,7 +64,17 @@ func download(path, dest string, firstAttempt bool) (root *vcs.RepoRoot, err err
|
||||
if root.VCS.Name == "Git" {
|
||||
root.VCS.CreateCmd = "clone --depth 1 {repo} {dir}"
|
||||
}
|
||||
err = root.VCS.Create(fullLocalPath, root.Repo)
|
||||
var rootRepo = root.Repo
|
||||
u, err := url.Parse(root.Repo)
|
||||
if err != nil {
|
||||
log.Printf("WARN: could not parse root.Repo: %v", err)
|
||||
} else {
|
||||
if u.Host == "github.com" {
|
||||
u.User = url.UserPassword("gojp", "gojp")
|
||||
rootRepo = u.String()
|
||||
}
|
||||
}
|
||||
err = root.VCS.Create(fullLocalPath, rootRepo)
|
||||
if err != nil {
|
||||
return root, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user