diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-01 18:38:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-01 18:38:06 +0000 |
commit | 133febf6d6c7b8f4c63002e065762cb3eec9ba15 (patch) | |
tree | 8f5ef1c843ca8a9984f25f18ffe88a456d2d40ba /lib | |
parent | 004d0ef00672e8445682235c4ef74fd9475bea24 (diff) | |
download | gitlab-ce-133febf6d6c7b8f4c63002e065762cb3eec9ba15.tar.gz |
Add latest changes from gitlab-org/security/gitlab@15-9-stable-ee
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/commits.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index ad2bbf90917..fa99a1a2bc8 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -86,11 +86,15 @@ module API get ':id/repository/commits', urgency: :low do not_found! 'Repository' unless user_project.repository_exists? + page = params[:page] > 0 ? params[:page] : 1 + per_page = params[:per_page] > 0 ? params[:per_page] : Kaminari.config.default_per_page + limit = [per_page, Kaminari.config.max_per_page].min + offset = (page - 1) * limit + path = params[:path] before = params[:until] after = params[:since] ref = params[:ref_name].presence || user_project.default_branch unless params[:all] - offset = (params[:page] - 1) * params[:per_page] all = params[:all] with_stats = params[:with_stats] first_parent = params[:first_parent] @@ -98,7 +102,7 @@ module API commits = user_project.repository.commits(ref, path: path, - limit: params[:per_page], + limit: limit, offset: offset, before: before, after: after, |