Commit 9a1ad8de authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Valery Sizov

Revert "Merge branch 'refactor-can-be-merge' into 'master'"

This reverts commit 459e6d34, reversing
changes made to 804168e1.
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 7c3e8bcd
......@@ -209,7 +209,13 @@ class MergeRequest < ActiveRecord::Base
if for_fork?
Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged?
else
project.repository.can_be_merged?(source_branch, target_branch)
rugged = project.repository.rugged
our_commit = rugged.branches[target_branch].target
their_commit = rugged.branches[source_branch].target
if our_commit && their_commit
!rugged.merge_commits(our_commit, their_commit).conflicts?
end
end
if can_be_merged
......
......@@ -411,15 +411,6 @@ class Repository
}
end
def can_be_merged?(source_branch, target_branch)
our_commit = rugged.branches[target_branch].target
their_commit = rugged.branches[source_branch].target
if our_commit && their_commit
!rugged.merge_commits(our_commit, their_commit).conflicts?
end
end
def search_files(query, ref)
offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})
......
......@@ -34,20 +34,6 @@ describe Repository do
end
end
describe :can_be_merged? do
context 'mergeable branches' do
subject { repository.can_be_merged?('feature', 'master') }
it { is_expected.to be_truthy }
end
context 'non-mergeable branches' do
subject { repository.can_be_merged?('feature_conflict', 'feature') }
it { is_expected.to be_falsey }
end
end
describe "search_files" do
let(:results) { repository.search_files('feature', 'master') }
subject { results }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment