summaryrefslogtreecommitdiff
path: root/app/services/compare_service.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-09-05 09:21:36 +0100
committerPhil Hughes <me@iamphill.com>2017-09-05 09:21:36 +0100
commit365adcf6a3bd684abfa9aac3b47e53c1eb41bac6 (patch)
tree7787c1190dc1393a5b91c5e882e77a6df26f2b2d /app/services/compare_service.rb
parent78b0c35ce71b2e6083d655c47977766bf56fbe72 (diff)
parentd4ec63186b106bbee4bde890b7c30b14a7748339 (diff)
downloadgitlab-ce-365adcf6a3bd684abfa9aac3b47e53c1eb41bac6.tar.gz
Merge branch 'master' into breadcrumbs-improvements
Diffstat (limited to 'app/services/compare_service.rb')
-rw-r--r--app/services/compare_service.rb22
1 files changed, 2 insertions, 20 deletions
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb
index a5ae4927412..53f16a236d2 100644
--- a/app/services/compare_service.rb
+++ b/app/services/compare_service.rb
@@ -11,26 +11,8 @@ class CompareService
end
def execute(target_project, target_branch, straight: false)
- # If compare with other project we need to fetch ref first
- target_project.repository.with_repo_branch_commit(
- start_project.repository,
- start_branch_name) do |commit|
- break unless commit
+ raw_compare = target_project.repository.compare_source_branch(target_branch, start_project.repository, start_branch_name, straight: straight)
- compare(commit.sha, target_project, target_branch, straight: straight)
- end
- end
-
- private
-
- def compare(source_sha, target_project, target_branch, straight:)
- raw_compare = Gitlab::Git::Compare.new(
- target_project.repository.raw_repository,
- target_branch,
- source_sha,
- straight: straight
- )
-
- Compare.new(raw_compare, target_project, straight: straight)
+ Compare.new(raw_compare, target_project, straight: straight) if raw_compare
end
end