diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-09-21 05:35:45 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-09-21 05:35:45 -0700 |
commit | 4afb7b7cb7b42688bea70298c80b4735f59dab22 (patch) | |
tree | 09b720d1beaa3e1e371345b3373629c9c9f63ae4 /lib/api/projects.rb | |
parent | 131553627d2e62cea2ea8a342250ca2d2495d8fc (diff) | |
parent | bbdb2c3fef5a71802131c08226d7f4dfa18ddd89 (diff) | |
download | gitlab-ce-4afb7b7cb7b42688bea70298c80b4735f59dab22.tar.gz |
Merge pull request #1522 from NARKOZ/apiv2.9.0
API clean up
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r-- | lib/api/projects.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 0554d97c86b..c3dc3da6fac 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -211,6 +211,24 @@ module Gitlab present user_project.repo.tags.sort_by(&:name).reverse, with: Entities::RepoObject end + # Get a project repository commits + # + # Parameters: + # id (required) - The ID or code name of a project + # ref_name (optional) - The name of a repository branch or tag + # Example Request: + # GET /projects/:id/repository/commits + get ":id/repository/commits" do + authorize! :download_code, user_project + + page = params[:page] || 0 + per_page = params[:per_page] || 20 + ref = params[:ref_name] || user_project.try(:default_branch) || 'master' + + commits = user_project.commits(ref, nil, per_page, page * per_page) + present CommitDecorator.decorate(commits), with: Entities::RepoCommit + end + # Get a project snippet # # Parameters: |