()
| 59 | } |
| 60 | |
| 61 | func (g *GitLabConfig) ListRepositories() ([]*Repository, error) { |
| 62 | repos, err := g.getAllRepos() |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | |
| 67 | out := make([]*Repository, 0, len(repos)) |
| 68 | for _, repo := range repos { |
| 69 | if isExcluded(g.Exclude, repo.PathWithNamespace) { |
| 70 | log.Printf("Skipping excluded repository: %s", repo.PathWithNamespace) |
| 71 | continue |
| 72 | } |
| 73 | |
| 74 | gitUrl, err := url.Parse(repo.HTTPURLToRepo) |
| 75 | if err != nil { |
| 76 | return nil, err |
| 77 | } |
| 78 | gitUrl.User = url.UserPassword("git", g.AccessToken) |
| 79 | |
| 80 | out = append(out, &Repository{ |
| 81 | GitURL: *gitUrl, |
| 82 | FullName: repo.PathWithNamespace, |
| 83 | }) |
| 84 | } |
| 85 | |
| 86 | return out, nil |
| 87 | } |
| 88 | |
| 89 | func (g *GitLabConfig) getAllRepos() ([]*gitlab.Project, error) { |
| 90 | all := make(map[string]*gitlab.Project, 0) |
nothing calls this directly
no test coverage detected