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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
57fc7cd8
Commit
57fc7cd8
authored
Jul 10, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure ConflictsService does not raise for conflicting submodules
parent
3d4873fa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
+31
-15
lib/gitlab/gitaly_client/conflicts_service.rb
lib/gitlab/gitaly_client/conflicts_service.rb
+6
-4
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+14
-8
spec/services/merge_requests/conflicts/list_service_spec.rb
spec/services/merge_requests/conflicts/list_service_spec.rb
+8
-2
spec/support/helpers/test_env.rb
spec/support/helpers/test_env.rb
+3
-1
No files found.
lib/gitlab/gitaly_client/conflicts_service.rb
View file @
57fc7cd8
...
...
@@ -25,10 +25,12 @@ module Gitlab
def
conflicts?
list_conflict_files
.
any?
rescue
GRPC
::
FailedPrecondition
# The server raises this exception when it encounters ConflictSideMissing, which
# means a conflict exists but its `theirs` or `ours` data is nil due to a non-existent
# file in one of the trees.
rescue
GRPC
::
FailedPrecondition
,
GRPC
::
Unknown
# The server raises FailedPrecondition when it encounters
# ConflictSideMissing, which means a conflict exists but its `theirs` or
# `ours` data is nil due to a non-existent file in one of the trees.
#
# GRPC::Unknown comes from Rugged::ReferenceError and Rugged::OdbError.
true
end
...
...
spec/models/repository_spec.rb
View file @
57fc7cd8
...
...
@@ -431,6 +431,18 @@ describe Repository do
it
{
is_expected
.
to
be_falsey
}
end
context
'non merged branch'
do
subject
{
repository
.
merged_to_root_ref?
(
'fix'
)
}
it
{
is_expected
.
to
be_falsey
}
end
context
'non existent branch'
do
subject
{
repository
.
merged_to_root_ref?
(
'non_existent_branch'
)
}
it
{
is_expected
.
to
be_nil
}
end
end
describe
'#can_be_merged?'
do
...
...
@@ -452,17 +464,11 @@ describe Repository do
it
{
is_expected
.
to
be_falsey
}
end
context
'
non merged branch
'
do
subject
{
repository
.
merged_to_root_ref?
(
'fix
'
)
}
context
'
submodule changes that confuse rugged
'
do
subject
{
repository
.
can_be_merged?
(
'update-gitlab-shell-v-6-0-1'
,
'update-gitlab-shell-v-6-0-3
'
)
}
it
{
is_expected
.
to
be_falsey
}
end
context
'non existent branch'
do
subject
{
repository
.
merged_to_root_ref?
(
'non_existent_branch'
)
}
it
{
is_expected
.
to
be_nil
}
end
end
describe
'#commit'
do
...
...
spec/services/merge_requests/conflicts/list_service_spec.rb
View file @
57fc7cd8
...
...
@@ -2,8 +2,8 @@ require 'spec_helper'
describe
MergeRequests
::
Conflicts
::
ListService
do
describe
'#can_be_resolved_in_ui?'
do
def
create_merge_request
(
source_branch
)
create
(
:merge_request
,
source_branch:
source_branch
,
target_branch:
'conflict-start'
,
merge_status: :unchecked
)
do
|
mr
|
def
create_merge_request
(
source_branch
,
target_branch
=
'conflict-start'
)
create
(
:merge_request
,
source_branch:
source_branch
,
target_branch:
target_branch
,
merge_status: :unchecked
)
do
|
mr
|
mr
.
mark_as_unmergeable
end
end
...
...
@@ -84,5 +84,11 @@ describe MergeRequests::Conflicts::ListService do
expect
(
service
.
can_be_resolved_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the conflict is in a submodule revision'
do
merge_request
=
create_merge_request
(
'update-gitlab-shell-v-6-0-3'
,
'update-gitlab-shell-v-6-0-1'
)
expect
(
conflicts_service
(
merge_request
).
can_be_resolved_in_ui?
).
to
be_falsey
end
end
end
spec/support/helpers/test_env.rb
View file @
57fc7cd8
...
...
@@ -49,7 +49,9 @@ module TestEnv
'add-pdf-file'
=>
'e774ebd'
,
'squash-large-files'
=>
'54cec52'
,
'add-pdf-text-binary'
=>
'79faa7b'
,
'add_images_and_changes'
=>
'010d106'
'add_images_and_changes'
=>
'010d106'
,
'update-gitlab-shell-v-6-0-1'
=>
'2f61d70'
,
'update-gitlab-shell-v-6-0-3'
=>
'de78448'
}.
freeze
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
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