diff options
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r-- | lib/api/repositories.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 076a9ceeb74..d59c25cf316 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -15,6 +15,7 @@ module API not_found! end end + # Get a project repository tags # # Parameters: @@ -118,6 +119,21 @@ module API not_found! end end + + # Compare two branches, tags or commits + # + # Parameters: + # id (required) - The ID of a project + # from (required) - the commit sha or branch name + # to (required) - the commit sha or branch name + # Example Request: + # GET /projects/:id/repository/compare?from=master&to=feature + get ':id/repository/compare' do + authorize! :download_code, user_project + compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE) + + present compare, with: Entities::Compare + end end end end |