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

🐛 handle gitlab repos with no commits #3731

Merged
merged 6 commits into from
Jan 4, 2024
Merged
Changes from 2 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
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) 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

Check warning on line 190 in clients/gitlabrepo/client.go

View check run for this annotation

Codecov / codecov/patch

clients/gitlabrepo/client.go#L190

Added line #L190 was not covered by tests
} else {
before = commitsRaw[0].CommittedDate
}
ashearin marked this conversation as resolved.
Show resolved Hide resolved
// 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
Loading