Skip to content

Commit

Permalink
Fix GitLab pagination
Browse files Browse the repository at this point in the history
GitLab starts counting at 1.
  • Loading branch information
muesli committed Dec 17, 2021
1 parent 860d6d2 commit e49dc8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vcs/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *Client) GetUsername() (string, error) {
func (c *Client) Issues(owner string, name string) ([]vcs.Issue, error) {
var i []vcs.Issue

page := 0
page := 1
for {
issues, resp, err := c.api.Issues.ListProjectIssues(owner+"/"+name,
&gitlab.ListProjectIssuesOptions{
Expand Down Expand Up @@ -100,7 +100,7 @@ func (c *Client) Issues(owner string, name string) ([]vcs.Issue, error) {
func (c *Client) PullRequests(owner string, name string) ([]vcs.PullRequest, error) {
var i []vcs.PullRequest

page := 0
page := 1
for {
prs, resp, err := c.api.MergeRequests.ListProjectMergeRequests(owner+"/"+name,
&gitlab.ListProjectMergeRequestsOptions{
Expand Down Expand Up @@ -151,7 +151,7 @@ func (c *Client) Repository(owner string, name string) (vcs.Repo, error) {
func (c *Client) Repositories(owner string) ([]vcs.Repo, error) {
var repos []vcs.Repo

page := 0
page := 1
for {
p, resp, err := c.api.Groups.ListGroupProjects(owner, &gitlab.ListGroupProjectsOptions{
ListOptions: gitlab.ListOptions{
Expand Down Expand Up @@ -235,7 +235,7 @@ func (c *Client) Branches(owner string, name string) ([]vcs.Branch, error) {
func (c *Client) History(repo vcs.Repo, max int, since time.Time) ([]vcs.Commit, error) {
var commits []vcs.Commit

page := 0
page := 1
for {
opt := gitlab.ListCommitsOptions{
ListOptions: gitlab.ListOptions{
Expand Down

0 comments on commit e49dc8a

Please sign in to comment.