Update gitlab path trim prefix if not all-groups (#268)

* Update gitlab path trim prefix if not all-groups
This commit is contained in:
gabrie30
2022-12-31 11:28:16 -08:00
committed by GitHub
parent e5820e2539
commit 13acc617af
3 changed files with 18 additions and 5 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -13,8 +13,9 @@ import (
)
var (
_ Client = Gitlab{}
perPage = 100
_ Client = Gitlab{}
perPage = 100
gitLabAllGroups = false
)
func init() {
@@ -41,6 +42,7 @@ func (c Gitlab) GetOrgRepos(targetOrg string) ([]Repo, error) {
}
if targetOrg == "all-groups" {
gitLabAllGroups = true
longFetch = true
grps, err := c.GetTopLevelGroups()
@@ -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)
}