From 2f780af2462d71164c2e11bc6147f87400303a64 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 29 Jul 2014 14:29:59 +0300 Subject: [PATCH] Git::Compare does not have limit param any more Signed-off-by: Dmitriy Zaporozhets --- app/services/compare_service.rb | 1 - app/workers/emails_on_push_worker.rb | 2 +- lib/api/entities.rb | 8 ++++---- lib/api/repositories.rb | 2 +- lib/gitlab/satellite/compare_action.rb | 6 +++++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb index e4c3bb1507d..c5e04702914 100644 --- a/app/services/compare_service.rb +++ b/app/services/compare_service.rb @@ -12,7 +12,6 @@ class CompareService target_project.repository.raw_repository, target_branch, source_branch, - 10000 ) ) else diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index 5e81810cbdb..2947c8e3ecd 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -13,7 +13,7 @@ class EmailsOnPushWorker return true end - compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha, MergeRequestDiff::COMMITS_SAFE_SIZE) + compare = Gitlab::Git::Compare.new(project.repository.raw_repository, before_sha, after_sha) # Do not send emails if git compare failed return false unless compare && compare.commits.present? diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 09fb97abf29..238416c5379 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -201,13 +201,13 @@ module API class Compare < Grape::Entity expose :commit, using: Entities::RepoCommit do |compare, options| - if compare.commit - Commit.new compare.commit - end + Commit.decorate(compare.commits).last end + expose :commits, using: Entities::RepoCommit do |compare, options| - Commit.decorate compare.commits + Commit.decorate(compare.commits) end + expose :diffs, using: Entities::RepoDiff do |compare, options| compare.diffs end diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index d091fa4f035..461ce4e59cf 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -147,7 +147,7 @@ module API get ':id/repository/compare' do authorize! :download_code, user_project required_attributes! [:from, :to] - compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE) + compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to]) present compare, with: Entities::Compare end diff --git a/lib/gitlab/satellite/compare_action.rb b/lib/gitlab/satellite/compare_action.rb index 4905b146a55..46c98a8f4ca 100644 --- a/lib/gitlab/satellite/compare_action.rb +++ b/lib/gitlab/satellite/compare_action.rb @@ -33,7 +33,11 @@ module Gitlab end def compare(repo) - @compare ||= Gitlab::Git::Compare.new(Gitlab::Git::Repository.new(repo.path), "origin/#{@target_branch}", "source/#{@source_branch}", 10000) + @compare ||= Gitlab::Git::Compare.new( + Gitlab::Git::Repository.new(repo.path), + "origin/#{@target_branch}", + "source/#{@source_branch}" + ) end end end