diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index fdcbbdc1d08..f1b9c1d6feb 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -238,15 +238,11 @@ class MergeRequest < ActiveRecord::Base end def target_branch_sha - return @target_branch_sha if defined?(@target_branch_sha) - - target_branch_head.try(:sha) + @target_branch_sha || target_branch_head.try(:sha) end def source_branch_sha - return @source_branch_sha if defined?(@source_branch_sha) - - source_branch_head.try(:sha) + @source_branch_sha || source_branch_head.try(:sha) end def diff_refs