Skip to content

Commit

Permalink
Add excludeorgs for gitlab. (#91)
Browse files Browse the repository at this point in the history
* Add excludeorgs for gitlab.

Gitlab does not explicitly have orgs but they do have Namespaces which
are roughly equivalent.

Signed-off-by: Drew Moseley <[email protected]>

* Add includeorgs for gitlab.

Signed-off-by: Drew Moseley <[email protected]>
  • Loading branch information
drewmoseley authored Feb 24, 2022
1 parent 70ddbc8 commit d96310d
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ func Get(conf *types.Conf) []types.Repo {
}

include := types.GetMap(repo.Include)
includeorgs := types.GetMap(repo.IncludeOrgs)
exclude := types.GetMap(repo.Exclude)
excludeorgs := types.GetMap(repo.ExcludeOrgs)

for _, r := range gitlabrepos {
if include[r.Name] {
Expand Down Expand Up @@ -210,18 +212,23 @@ func Get(conf *types.Conf) []types.Repo {
if exclude[r.Name] {
continue
}
if excludeorgs[r.Namespace.FullPath] {
continue
}
if len(include) == 0 {
if r.RepositoryAccessLevel != gitlab.DisabledAccessControl {
repos = append(repos, types.Repo{Name: r.Path, Url: r.HTTPURLToRepo, SshUrl: r.SSHURLToRepo, Token: token, Defaultbranch: r.DefaultBranch, Origin: repo, Owner: k, Hoster: types.GetHost(repo.Url)})
}
if len(includeorgs) == 0 || includeorgs[r.Namespace.FullPath] {
if r.RepositoryAccessLevel != gitlab.DisabledAccessControl {
repos = append(repos, types.Repo{Name: r.Path, Url: r.HTTPURLToRepo, SshUrl: r.SSHURLToRepo, Token: token, Defaultbranch: r.DefaultBranch, Origin: repo, Owner: k, Hoster: types.GetHost(repo.Url)})
}

if r.WikiEnabled && repo.Wiki {
if activeWiki(r, client, repo) {
httpUrlToRepo := types.DotGitRx.ReplaceAllString(r.HTTPURLToRepo, ".wiki.git")
sshUrlToRepo := types.DotGitRx.ReplaceAllString(r.SSHURLToRepo, ".wiki.git")
repos = append(repos, types.Repo{Name: r.Path + ".wiki", Url: httpUrlToRepo, SshUrl: sshUrlToRepo, Token: token, Defaultbranch: r.DefaultBranch, Origin: repo, Owner: k, Hoster: types.GetHost(repo.Url)})
if r.WikiEnabled && repo.Wiki {
if activeWiki(r, client, repo) {
httpUrlToRepo := types.DotGitRx.ReplaceAllString(r.HTTPURLToRepo, ".wiki.git")
sshUrlToRepo := types.DotGitRx.ReplaceAllString(r.SSHURLToRepo, ".wiki.git")
repos = append(repos, types.Repo{Name: r.Path + ".wiki", Url: httpUrlToRepo, SshUrl: sshUrlToRepo, Token: token, Defaultbranch: r.DefaultBranch, Origin: repo, Owner: k, Hoster: types.GetHost(repo.Url)})
}
}
}
}
}
}
}
Expand Down

0 comments on commit d96310d

Please sign in to comment.