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
Léo-Paul Géneau
gitlab-ce
Commits
7a7e9288
Commit
7a7e9288
authored
May 18, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop MR conflict code from blowing up when branches are missing
parent
b46b52af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-0
app/services/merge_requests/conflicts/list_service.rb
app/services/merge_requests/conflicts/list_service.rb
+1
-0
lib/gitlab/diff/position_tracer.rb
lib/gitlab/diff/position_tracer.rb
+1
-1
spec/services/merge_requests/conflicts/list_service_spec.rb
spec/services/merge_requests/conflicts/list_service_spec.rb
+7
-0
No files found.
app/models/merge_request.rb
View file @
7a7e9288
...
@@ -293,6 +293,8 @@ class MergeRequest < ActiveRecord::Base
...
@@ -293,6 +293,8 @@ class MergeRequest < ActiveRecord::Base
attr_writer
:target_branch_sha
,
:source_branch_sha
attr_writer
:target_branch_sha
,
:source_branch_sha
def
source_branch_head
def
source_branch_head
return
unless
source_project
source_branch_ref
=
@source_branch_sha
||
source_branch
source_branch_ref
=
@source_branch_sha
||
source_branch
source_project
.
repository
.
commit
(
source_branch_ref
)
if
source_branch_ref
source_project
.
repository
.
commit
(
source_branch_ref
)
if
source_branch_ref
end
end
...
...
app/services/merge_requests/conflicts/list_service.rb
View file @
7a7e9288
...
@@ -15,6 +15,7 @@ module MergeRequests
...
@@ -15,6 +15,7 @@ module MergeRequests
return
@conflicts_can_be_resolved_in_ui
=
false
unless
merge_request
.
cannot_be_merged?
return
@conflicts_can_be_resolved_in_ui
=
false
unless
merge_request
.
cannot_be_merged?
return
@conflicts_can_be_resolved_in_ui
=
false
unless
merge_request
.
has_complete_diff_refs?
return
@conflicts_can_be_resolved_in_ui
=
false
unless
merge_request
.
has_complete_diff_refs?
return
@conflicts_can_be_resolved_in_ui
=
false
if
merge_request
.
branch_missing?
begin
begin
# Try to parse each conflict. If the MR's mergeable status hasn't been
# Try to parse each conflict. If the MR's mergeable status hasn't been
...
...
lib/gitlab/diff/position_tracer.rb
View file @
7a7e9288
...
@@ -16,7 +16,7 @@ module Gitlab
...
@@ -16,7 +16,7 @@ module Gitlab
end
end
def
trace
(
old_position
)
def
trace
(
old_position
)
return
unless
old_diff_refs
.
complete?
&&
new_diff_refs
.
complete?
return
unless
old_diff_refs
&
.
complete?
&&
new_diff_refs
&
.
complete?
return
unless
old_position
.
diff_refs
==
old_diff_refs
return
unless
old_position
.
diff_refs
==
old_diff_refs
# Suppose we have an MR with source branch `feature` and target branch `master`.
# Suppose we have an MR with source branch `feature` and target branch `master`.
...
...
spec/services/merge_requests/conflicts/list_service_spec.rb
View file @
7a7e9288
...
@@ -25,6 +25,13 @@ describe MergeRequests::Conflicts::ListService do
...
@@ -25,6 +25,13 @@ describe MergeRequests::Conflicts::ListService do
expect
(
conflicts_service
(
merge_request
).
can_be_resolved_in_ui?
).
to
be_falsey
expect
(
conflicts_service
(
merge_request
).
can_be_resolved_in_ui?
).
to
be_falsey
end
end
it
'returns a falsey value when one of the MR branches is missing'
do
merge_request
=
create_merge_request
(
'conflict-resolvable'
)
merge_request
.
project
.
repository
.
rm_branch
(
merge_request
.
author
,
'conflict-resolvable'
)
expect
(
conflicts_service
(
merge_request
).
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'
)
service
=
conflicts_service
(
merge_request
)
service
=
conflicts_service
(
merge_request
)
...
...
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