Skip to content

Commit

Permalink
fix: handle gitlab repos with no commits
Browse files Browse the repository at this point in the history
Signed-off-by: Allen Shearin <[email protected]>
  • Loading branch information
ashearin committed Dec 12, 2023
1 parent 663e1a9 commit 28288ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clients/gitlabrepo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,17 @@ func (client *Client) GetFileContent(filename string) ([]byte, error) {
func (client *Client) ListCommits() ([]clients.Commit, error) {
// Get commits from REST API
commitsRaw, err := client.commits.listRawCommits()
var before *time.Time

if err != nil {
return []clients.Commit{}, err
}

before := commitsRaw[0].CommittedDate
if len(commitsRaw) < 1 {
return []clients.Commit{}, nil
} else {
before = commitsRaw[0].CommittedDate
}
// Get merge request details from GraphQL
// GitLab REST API doesn't provide a way to link Merge Requests and Commits that
// are within them without making a REST call for each commit (~30 by default)
Expand Down

0 comments on commit 28288ae

Please sign in to comment.