Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-09 20:23:49 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-12-09 20:23:49 +0300
commit3e01385bca92dc8c0df3aa4032cc58d708dc0ff5 (patch)
treed3377281dcf09bf3af01b29b994017f2d33f3b61 /app/services/compare_service.rb
parentbb9d30590d4ca5b25d5020234916ce961acf15b6 (diff)
Should pass branch name, not commit object!
Diffstat (limited to 'app/services/compare_service.rb')
-rw-r--r--app/services/compare_service.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb
index fcbfe68f1a3..31c371c4b34 100644
--- a/app/services/compare_service.rb
+++ b/app/services/compare_service.rb
@@ -3,15 +3,16 @@ require 'securerandom'
# Compare 2 branches for one repo or between repositories
# and return Gitlab::Git::Compare object that responds to commits and diffs
class CompareService
- attr_reader :source_project, :source_branch
+ attr_reader :source_project, :source_branch_name
- def initialize(new_source_project, source_branch_name)
+ def initialize(new_source_project, new_source_branch_name)
@source_project = new_source_project
- @source_branch = new_source_project.commit(source_branch_name)
+ @source_branch_name = new_source_branch_name
end
def execute(target_project, target_branch, straight: false)
- source_sha = source_branch.try(:sha)
+ source_sha = source_project.repository.
+ commit(source_branch_name).try(:sha)
return unless source_sha
@@ -20,7 +21,7 @@ class CompareService
compare(source_sha, target_project, target_branch, straight)
else
target_project.repository.with_tmp_ref(
- source_project.repository, source_branch) do
+ source_project.repository, source_branch_name) do
compare(source_sha, target_project, target_branch, straight)
end
end