Skip to content

Commit

Permalink
Update gitlab path trim prefix if not all-groups (#268)
Browse files Browse the repository at this point in the history
* Update gitlab path trim prefix if not all-groups
  • Loading branch information
gabrie30 authored Dec 31, 2022
1 parent e5820e2 commit 13acc61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [1.9.2] - 12/31/22
### Added
### Changed
### Deprecated
### Removed
### Fixed
- GitLab nested group names; thanks @MaxG87
### Security

## [1.9.1] - 12/11/22
### Added
- Ability to clone all users repos on hosted GitLab instances; thanks @mlaily
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

const ghorgVersion = "v1.9.1"
const ghorgVersion = "v1.9.2"

var versionCmd = &cobra.Command{
Use: "version",
Expand Down
11 changes: 7 additions & 4 deletions scm/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
)

var (
_ Client = Gitlab{}
perPage = 100
_ Client = Gitlab{}
perPage = 100
gitLabAllGroups = false
)

func init() {
Expand All @@ -41,6 +42,7 @@ func (c Gitlab) GetOrgRepos(targetOrg string) ([]Repo, error) {
}

if targetOrg == "all-groups" {
gitLabAllGroups = true
longFetch = true

grps, err := c.GetTopLevelGroups()
Expand Down Expand Up @@ -297,9 +299,10 @@ func (c Gitlab) filter(group string, ps []*gitlab.Project) []Repo {

path := p.PathWithNamespace

// For GitLab Cloud, the PathWithNamespace includes the org/group name
// The PathWithNamespace includes the org/group name
// https://github.com/gabrie30/ghorg/issues/228
if os.Getenv("GHORG_SCM_BASE_URL") == "" {
// https://github.com/gabrie30/ghorg/issues/267
if !gitLabAllGroups {
path = strings.TrimPrefix(path, group)
}

Expand Down

0 comments on commit 13acc61

Please sign in to comment.