MCPcopy Create free account
hub / github.com/ChappIO/git-backup / ListRepositories

Method ListRepositories

gitlab.go:61–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59}
60
61func (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
89func (g *GitLabConfig) getAllRepos() ([]*gitlab.Project, error) {
90 all := make(map[string]*gitlab.Project, 0)

Callers

nothing calls this directly

Calls 2

getAllReposMethod · 0.95
isExcludedFunction · 0.85

Tested by

no test coverage detected