summaryrefslogtreecommitdiff
path: root/app/services/compare_service.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2017-08-23 17:14:21 +0200
committerJacob Vosmaer <jacob@gitlab.com>2017-08-31 15:35:59 +0200
commit8ad690b0d4f9db528c40e7f523e6f8219c944d48 (patch)
treecafe45b09c7f18a196b69897a77387b19cfaaff1 /app/services/compare_service.rb
parent3e092caa91853afeab3bb01be10869e45c39de5d (diff)
downloadgitlab-ce-8ad690b0d4f9db528c40e7f523e6f8219c944d48.tar.gz
Prepare GitOperationService for move to Gitlab::Git
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