Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

full_path is used as namespace in GitLab repository. #49

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scm/driver/gitlab/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ type repository struct {
}

type namespace struct {
Name string `json:"name"`
Path string `json:"path"`
Name string `json:"name"`
Path string `json:"path"`
FullPath string `json:"full_path"`
}

type permissions struct {
Expand Down Expand Up @@ -172,7 +173,7 @@ func convertRepositoryList(from []*repository) []*scm.Repository {
func convertRepository(from *repository) *scm.Repository {
to := &scm.Repository{
ID: strconv.Itoa(from.ID),
Namespace: from.Namespace.Path,
Namespace: from.Namespace.FullPath,
Name: from.Path,
Branch: from.DefaultBranch,
Private: convertPrivate(from.Visibility),
Expand Down
59 changes: 58 additions & 1 deletion scm/driver/gitlab/testdata/repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,62 @@
"only_allow_merge_if_all_discussions_are_resolved": null,
"printing_merge_request_link_enabled": true,
"approvals_before_merge": 0
},
{
"id": 178505,
"description": "",
"default_branch": "master",
"tag_list": [],
"ssh_url_to_repo": "git@gitlab.com:diaspora/drone/diaspora.git",
"http_url_to_repo": "https://gitlab.com/diaspora/drone/diaspora.git",
"web_url": "https://gitlab.com/diaspora/drone/diaspora",
"name": "Diaspora",
"name_with_namespace": "diaspora / drone / Diaspora",
"path": "diaspora",
"path_with_namespace": "diaspora/drone/diaspora",
"avatar_url": null,
"star_count": 0,
"forks_count": 0,
"created_at": "2015-03-03T18:37:05.387Z",
"last_activity_at": "2015-03-03T18:37:20.795Z",
"_links": {
"self": "http://gitlab.com/api/v4/projects/178505",
"issues": "http://gitlab.com/api/v4/projects/178505/issues",
"merge_requests": "http://gitlab.com/api/v4/projects/178505/merge_requests",
"repo_branches": "http://gitlab.com/api/v4/projects/178505/repository/branches",
"labels": "http://gitlab.com/api/v4/projects/178505/labels",
"events": "http://gitlab.com/api/v4/projects/178505/events",
"members": "http://gitlab.com/api/v4/projects/178505/members"
},
"archived": false,
"visibility": "public",
"resolve_outdated_diff_discussions": null,
"container_registry_enabled": null,
"issues_enabled": true,
"merge_requests_enabled": true,
"wiki_enabled": true,
"jobs_enabled": true,
"snippets_enabled": false,
"shared_runners_enabled": true,
"lfs_enabled": true,
"creator_id": 57658,
"namespace": {
"id": 120836,
"name": "drone",
"path": "drone",
"kind": "group",
"full_path": "diaspora/drone",
"parent_id": null
},
"import_status": "finished",
"open_issues_count": 0,
"public_jobs": true,
"ci_config_path": null,
"shared_with_groups": [],
"only_allow_merge_if_pipeline_succeeds": false,
"request_access_enabled": true,
"only_allow_merge_if_all_discussions_are_resolved": null,
"printing_merge_request_link_enabled": true,
"approvals_before_merge": 0
}
]
]
19 changes: 18 additions & 1 deletion scm/driver/gitlab/testdata/repos.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,22 @@
"Link": "",
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
},
{
"ID": "178505",
"Namespace": "diaspora/drone",
"Name": "diaspora",
"Perm": {
"Pull": true,
"Push": false,
"Admin": false
},
"Branch": "master",
"Private": false,
"Clone": "https://gitlab.com/diaspora/drone/diaspora.git",
"CloneSSH": "git@gitlab.com:diaspora/drone/diaspora.git",
"Link": "",
"Created": "0001-01-01T00:00:00Z",
"Updated": "0001-01-01T00:00:00Z"
}
]
]