summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-03-01 15:54:43 +0000
committerDouwe Maan <douwe@gitlab.com>2018-03-01 15:54:43 +0000
commitde454de9b10f0dd534884c8ffeabe3e534993349 (patch)
tree40d8079befbc40943c17f781cb3856f011715d0a /lib/api
parent461960262d51c719994f0f4236f79dfa1fc0f28f (diff)
parentcd9daf644e2b3844b9382768a3add335f942b76c (diff)
downloadgitlab-ce-de454de9b10f0dd534884c8ffeabe3e534993349.tar.gz
Merge branch '42434-allow-commits-endpoint-to-work-over-all-commits' into 'master'
Resolve "Allow API method /projects/:id/repository/commits to work over all commits" Closes #42434 See merge request gitlab-org/gitlab-ce!17182
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/commits.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index 3d6e78d2d80..982f45425a3 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -18,25 +18,28 @@ module API
optional :since, type: DateTime, desc: 'Only commits after or on this date will be returned'
optional :until, type: DateTime, desc: 'Only commits before or on this date will be returned'
optional :path, type: String, desc: 'The file path'
+ optional :all, type: Boolean, desc: 'Every commit will be returned'
use :pagination
end
get ':id/repository/commits' do
path = params[:path]
before = params[:until]
after = params[:since]
- ref = params[:ref_name] || user_project.try(:default_branch) || 'master'
+ ref = params[:ref_name] || user_project.try(:default_branch) || 'master' unless params[:all]
offset = (params[:page] - 1) * params[:per_page]
+ all = params[:all]
commits = user_project.repository.commits(ref,
path: path,
limit: params[:per_page],
offset: offset,
before: before,
- after: after)
+ after: after,
+ all: all)
commit_count =
- if path || before || after
- user_project.repository.count_commits(ref: ref, path: path, before: before, after: after)
+ if all || path || before || after
+ user_project.repository.count_commits(ref: ref, path: path, before: before, after: after, all: all)
else
# Cacheable commit count.
user_project.repository.commit_count_for_ref(ref)