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

This reverts commit 459e6d3467, reversing
changes made to 804168e1de.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-08-11 10:48:02 +02:00
parent 9f10943c1a
commit 32046983ad
No known key found for this signature in database
GPG key ID: 161B5D6A44D3D88A
3 changed files with 7 additions and 24 deletions

View file

@ -209,7 +209,13 @@ class MergeRequest < ActiveRecord::Base
if for_fork? if for_fork?
Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged? Gitlab::Satellite::MergeAction.new(self.author, self).can_be_merged?
else 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 end
if can_be_merged if can_be_merged

View file

@ -411,15 +411,6 @@ class Repository
} }
end 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) def search_files(query, ref)
offset = 2 offset = 2
args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref}) args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} #{query} #{ref || root_ref})

View file

@ -34,20 +34,6 @@ describe Repository do
end end
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 describe "search_files" do
let(:results) { repository.search_files('feature', 'master') } let(:results) { repository.search_files('feature', 'master') }
subject { results } subject { results }