diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-03-08 04:29:12 +0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2018-03-08 04:46:29 +0300 |
commit | c6273ec50c019a115b11a8ef1032a64710f0a46a (patch) | |
tree | ce1a808bafc98f2181a621b75e293c4c27d1899e /app/services/compare_service.rb | |
parent | 7734e85bc6592c5ad3330c611c5f83a051b680b0 (diff) |
Avoid re-fetching merge-base SHA from Gitaly unnecessarily
Diffstat (limited to 'app/services/compare_service.rb')
-rw-r--r-- | app/services/compare_service.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb index 1db91c3c90c..2a69a205629 100644 --- a/app/services/compare_service.rb +++ b/app/services/compare_service.rb @@ -10,9 +10,14 @@ class CompareService @start_ref_name = new_start_ref_name end - def execute(target_project, target_ref, straight: false) + def execute(target_project, target_ref, base_sha: nil, straight: false) raw_compare = target_project.repository.compare_source_branch(target_ref, start_project.repository, start_ref_name, straight: straight) - Compare.new(raw_compare, target_project, straight: straight) if raw_compare + return unless raw_compare + + Compare.new(raw_compare, + target_project, + base_sha: base_sha, + straight: straight) end end |