summaryrefslogtreecommitdiff
path: root/lib/api/commits.rb
diff options
context:
space:
mode:
authorLong Nguyen <long.polyglot@gmail.com>2016-05-05 15:02:46 +0700
committerLong Nguyen <long.polyglot@gmail.com>2016-05-05 15:02:46 +0700
commite016cdb73ea8d57180594b4a8198a6272c338d73 (patch)
tree357dbd2af5ff53a7e8ecdbc70dcb10e25ac23048 /lib/api/commits.rb
parent91f693c0c4f1ebb62d78e6c82b833f8a19c4dc62 (diff)
parentf5ae92d81c022e94500eb9a6949b2322a943a5af (diff)
downloadgitlab-ce-e016cdb73ea8d57180594b4a8198a6272c338d73.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into issue_14532_assign_labels_milestone_when_moving_issue
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