summaryrefslogtreecommitdiff
path: root/lib/api/commits.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 20:21:02 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 20:21:02 +0300
commit71da2e0b56a89fc87f2da3685bdebb333690593a (patch)
treebe6418658f118746ab158be162622fe8cb5f0b0e /lib/api/commits.rb
parent011a905a821e2ff0cd2d9885ef93764018eb8346 (diff)
parent44501820152083d231459223fe09b9d9641b7c1e (diff)
downloadgitlab-ce-71da2e0b56a89fc87f2da3685bdebb333690593a.tar.gz
Merge remote-tracking branch 'origin/master' into docker-registry
Diffstat (limited to 'lib/api/commits.rb')
-rw-r--r--lib/api/commits.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index 4544a41b1e3..93a3a5ce089 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -12,14 +12,20 @@ module API
# Parameters:
# id (required) - The ID of a project
# ref_name (optional) - The name of a repository branch or tag, if not given the default branch is used
+ # since (optional) - Only commits after or in this date will be returned
+ # until (optional) - Only commits before or in this date will be returned
# Example Request:
# GET /projects/:id/repository/commits
get ":id/repository/commits" do
+ datetime_attributes! :since, :until
+
page = (params[:page] || 0).to_i
per_page = (params[:per_page] || 20).to_i
ref = params[:ref_name] || user_project.try(:default_branch) || 'master'
+ after = params[:since]
+ before = params[:until]
- commits = user_project.repository.commits(ref, nil, per_page, page * per_page)
+ commits = user_project.repository.commits(ref, limit: per_page, offset: page * per_page, after: after, before: before)
present commits, with: Entities::RepoCommit
end