summaryrefslogtreecommitdiff
path: root/app/models/compare.rb
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-03-08 11:39:50 -0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-03-08 11:39:50 -0300
commit5174e99aa288c1bea2b2f65104aa37f7f1fc794e (patch)
tree6b3d7051b73eee25289c578f101519e49c93610a /app/models/compare.rb
parentc6273ec50c019a115b11a8ef1032a64710f0a46a (diff)
downloadgitlab-ce-5174e99aa288c1bea2b2f65104aa37f7f1fc794e.tar.gz
Remove unused Compare#base_commitosw-stop-recalculating-merge-base-on-mr-loading
Diffstat (limited to 'app/models/compare.rb')
-rw-r--r--app/models/compare.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/app/models/compare.rb b/app/models/compare.rb
index 19ea2bc3065..feb4b89c781 100644
--- a/app/models/compare.rb
+++ b/app/models/compare.rb
@@ -41,21 +41,16 @@ class Compare
end
alias_method :commit, :head_commit
- def base_commit
- strong_memoize(:base_commit) do
- return unless start_commit && head_commit
- return OpenStruct.new(sha: @base_sha) if @base_sha
-
- project.merge_base_commit(start_commit.id, head_commit.id)
- end
- end
-
def start_commit_sha
start_commit&.sha
end
def base_commit_sha
- base_commit&.sha
+ strong_memoize(:base_commit) do
+ next unless start_commit && head_commit
+
+ @base_sha || project.merge_base_commit(start_commit.id, head_commit.id)&.sha
+ end
end
def head_commit_sha