diff options
author | Long Nguyen <long.polyglot@gmail.com> | 2016-05-05 15:02:46 +0700 |
---|---|---|
committer | Long Nguyen <long.polyglot@gmail.com> | 2016-05-05 15:02:46 +0700 |
commit | e016cdb73ea8d57180594b4a8198a6272c338d73 (patch) | |
tree | 357dbd2af5ff53a7e8ecdbc70dcb10e25ac23048 /lib/api/commits.rb | |
parent | 91f693c0c4f1ebb62d78e6c82b833f8a19c4dc62 (diff) | |
parent | f5ae92d81c022e94500eb9a6949b2322a943a5af (diff) | |
download | gitlab-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.rb | 8 |
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 |