From d139cc6b3283cef8f14660738d423ea63317203c Mon Sep 17 00:00:00 2001 From: Gabor Nagy Date: Sun, 25 Aug 2013 23:21:00 +0200 Subject: Adds feature: get a diff via API. --- lib/api/repositories.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/api') 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: -- cgit v1.2.1