Revert "Merge branch 'refactor-can-be-merge' into 'master'"
This reverts commit459e6d3467
, reversing changes made to804168e1de
. Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
9f10943c1a
commit
32046983ad
3 changed files with 7 additions and 24 deletions
|
@ -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 }
|
||||
|
|
Loading…
Reference in a new issue