(args *Args)
| 40 | } |
| 41 | |
| 42 | func transformFetchArgs(args *Args) error { |
| 43 | names := parseRemoteNames(args) |
| 44 | |
| 45 | localRepo, err := github.LocalRepo() |
| 46 | utils.Check(err) |
| 47 | |
| 48 | currentProject, currentProjectErr := localRepo.CurrentProject() |
| 49 | |
| 50 | projects := make(map[*github.Project]bool) |
| 51 | ownerRegexp := regexp.MustCompile(fmt.Sprintf("^%s$", OwnerRe)) |
| 52 | for _, name := range names { |
| 53 | if ownerRegexp.MatchString(name) && !isCloneable(name) { |
| 54 | _, err := localRepo.RemoteByName(name) |
| 55 | if err != nil { |
| 56 | utils.Check(currentProjectErr) |
| 57 | project := github.NewProject(name, currentProject.Name, "") |
| 58 | gh := github.NewClient(project.Host) |
| 59 | repo, err := gh.Repository(project) |
| 60 | if err != nil { |
| 61 | continue |
| 62 | } |
| 63 | |
| 64 | projects[project] = repo.Private || repo.Permissions.Push |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | for project, private := range projects { |
| 70 | args.Before("git", "remote", "add", project.Owner, project.GitURL("", "", private)) |
| 71 | } |
| 72 | |
| 73 | return nil |
| 74 | } |
| 75 | |
| 76 | func parseRemoteNames(args *Args) (names []string) { |
| 77 | words := args.Words() |
no test coverage detected
searching dependent graphs…