diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-26 04:02:09 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-26 04:02:09 -0700 |
commit | c8e3d3192532839b7648301eb0849fd76da4f04b (patch) | |
tree | 1b159d9ac0a8fe043d9d9875b6b1c5869395937f /lib | |
parent | 45c39250209aa4bcfc41c82445cf4ae68a45b880 (diff) | |
parent | d139cc6b3283cef8f14660738d423ea63317203c (diff) | |
download | gitlab-ce-c8e3d3192532839b7648301eb0849fd76da4f04b.tar.gz |
Merge pull request #4892 from Aigeruth/feature/api-add-diff
Feature: get the diff of a commit via API.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/repositories.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 5db17b7e414..7e806546d02 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -102,6 +102,20 @@ module API present commits, with: Entities::RepoCommit end + # Get a specific commit of a project + # + # Parameters: + # id (required) - The ID of a project + # sha (required) - The commit or branch name + # Example Request: + # GET /projects/:id/repository/commit/:sha + get ":id/repository/commit/:sha" do + authorize! :download_code, user_project + sha = params[:sha] + result = CommitLoadContext.new(user_project, current_user, {id: sha}).execute + result[:commit].diffs + end + # Get a project repository tree # # Parameters: |