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
Tatuya Kamada
gitlab-ce
Commits
67beaf6f
Commit
67beaf6f
authored
Aug 25, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't show conflicts when there are none
parent
4a3d1a58
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/merge_request.rb
app/models/merge_request.rb
+5
-1
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+6
-0
No files found.
app/models/merge_request.rb
View file @
67beaf6f
...
@@ -777,7 +777,11 @@ class MergeRequest < ActiveRecord::Base
...
@@ -777,7 +777,11 @@ class MergeRequest < ActiveRecord::Base
return
@conflicts_can_be_resolved_in_ui
=
false
unless
has_complete_diff_refs?
return
@conflicts_can_be_resolved_in_ui
=
false
unless
has_complete_diff_refs?
begin
begin
@conflicts_can_be_resolved_in_ui
=
conflicts
.
files
.
each
(
&
:lines
)
# Try to parse each conflict. If the MR's mergeable status hasn't been updated,
# ensure that we don't say there are conflicts to resolve when there are no conflict
# files.
conflicts
.
files
.
each
(
&
:lines
)
@conflicts_can_be_resolved_in_ui
=
conflicts
.
files
.
length
>
0
rescue
Rugged
::
OdbError
,
Gitlab
::
Conflict
::
Parser
::
ParserError
,
Gitlab
::
Conflict
::
FileCollection
::
ConflictSideMissing
rescue
Rugged
::
OdbError
,
Gitlab
::
Conflict
::
Parser
::
ParserError
,
Gitlab
::
Conflict
::
FileCollection
::
ConflictSideMissing
@conflicts_can_be_resolved_in_ui
=
false
@conflicts_can_be_resolved_in_ui
=
false
end
end
...
...
spec/models/merge_request_spec.rb
View file @
67beaf6f
...
@@ -890,6 +890,12 @@ describe MergeRequest, models: true do
...
@@ -890,6 +890,12 @@ describe MergeRequest, models: true do
expect
(
merge_request
.
conflicts_can_be_resolved_in_ui?
).
to
be_falsey
expect
(
merge_request
.
conflicts_can_be_resolved_in_ui?
).
to
be_falsey
end
end
it
'returns a falsey value when the MR is marked as having conflicts, but has none'
do
merge_request
=
create_merge_request
(
'master'
)
expect
(
merge_request
.
conflicts_can_be_resolved_in_ui?
).
to
be_falsey
end
it
'returns a falsey value when the MR has a missing ref after a force push'
do
it
'returns a falsey value when the MR has a missing ref after a force push'
do
merge_request
=
create_merge_request
(
'conflict-resolvable'
)
merge_request
=
create_merge_request
(
'conflict-resolvable'
)
allow
(
merge_request
.
conflicts
).
to
receive
(
:merge_index
).
and_raise
(
Rugged
::
OdbError
)
allow
(
merge_request
.
conflicts
).
to
receive
(
:merge_index
).
and_raise
(
Rugged
::
OdbError
)
...
...
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