Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
46b56b18
Commit
46b56b18
authored
Jun 19, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mergablility check to Gitaly
Closes
https://gitlab.com/gitlab-org/gitaly/issues/889
parent
38edd5c3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
44 deletions
+21
-44
app/models/repository.rb
app/models/repository.rb
+1
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-15
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+18
-28
No files found.
app/models/repository.rb
View file @
46b56b18
...
...
@@ -847,7 +847,7 @@ class Repository
@root_ref_sha
||=
commit
(
root_ref
).
sha
end
delegate
:merged_branch_names
,
:can_be_merged?
,
to: :raw_repository
delegate
:merged_branch_names
,
to: :raw_repository
def
merge_base
(
first_commit_id
,
second_commit_id
)
first_commit_id
=
commit
(
first_commit_id
).
try
(
:id
)
||
first_commit_id
...
...
lib/gitlab/git/repository.rb
View file @
46b56b18
...
...
@@ -1413,13 +1413,8 @@ module Gitlab
end
def
can_be_merged?
(
source_sha
,
target_branch
)
gitaly_migrate
(
:can_be_merged
)
do
|
is_enabled
|
if
is_enabled
gitaly_can_be_merged?
(
source_sha
,
find_branch
(
target_branch
,
true
).
target
)
else
rugged_can_be_merged?
(
source_sha
,
target_branch
)
end
end
target_sha
=
find_branch
(
target_branch
,
true
).
target
!
gitaly_conflicts_client
(
source_sha
,
target_sha
).
conflicts?
end
def
search_files_by_name
(
query
,
ref
)
...
...
@@ -2236,14 +2231,6 @@ module Gitlab
run_git
([
'fetch'
,
remote_name
],
env:
env
).
last
.
zero?
end
def
gitaly_can_be_merged?
(
their_commit
,
our_commit
)
!
gitaly_conflicts_client
(
our_commit
,
their_commit
).
conflicts?
end
def
rugged_can_be_merged?
(
their_commit
,
our_commit
)
!
rugged
.
merge_commits
(
our_commit
,
their_commit
).
conflicts?
end
def
gitlab_projects_error
raise
CommandError
,
@gitlab_projects
.
output
end
...
...
spec/models/repository_spec.rb
View file @
46b56b18
...
...
@@ -434,7 +434,6 @@ describe Repository do
end
describe
'#can_be_merged?'
do
shared_examples
'can be merged'
do
context
'mergeable branches'
do
subject
{
repository
.
can_be_merged?
(
'0b4bc9a49b562e85de7cc9e834518ea6828729b9'
,
'master'
)
}
...
...
@@ -466,15 +465,6 @@ describe Repository do
end
end
context
'when Gitaly can_be_merged feature is enabled'
do
it_behaves_like
'can be merged'
end
context
'when Gitaly can_be_merged feature is disabled'
,
:disable_gitaly
do
it_behaves_like
'can be merged'
end
end
describe
'#commit'
do
context
'when ref exists'
do
it
'returns commit object'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment