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
9e9965ba
Commit
9e9965ba
authored
Nov 18, 2016
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Do not create a MergeRequestDiff record when source branch is deleted"
This reverts commit
f913170e
.
parent
5018bdcd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
26 deletions
+9
-26
app/services/merge_requests/refresh_service.rb
app/services/merge_requests/refresh_service.rb
+9
-12
changelogs/unreleased/fix-merge-request-screen-deleted-source-branch.yml
...leased/fix-merge-request-screen-deleted-source-branch.yml
+0
-4
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+0
-10
No files found.
app/services/merge_requests/refresh_service.rb
View file @
9e9965ba
...
...
@@ -60,7 +60,15 @@ module MergeRequests
merge_requests
=
filter_merge_requests
(
merge_requests
)
merge_requests
.
each
do
|
merge_request
|
reload_diff
(
merge_request
)
unless
branch_removed?
if
merge_request
.
source_branch
==
@branch_name
||
force_push?
merge_request
.
reload_diff
else
mr_commit_ids
=
merge_request
.
commits
.
map
(
&
:id
)
push_commit_ids
=
@commits
.
map
(
&
:id
)
matches
=
mr_commit_ids
&
push_commit_ids
merge_request
.
reload_diff
if
matches
.
any?
end
merge_request
.
mark_as_unchecked
end
end
...
...
@@ -165,16 +173,5 @@ module MergeRequests
def
branch_removed?
Gitlab
::
Git
.
blank_ref?
(
@newrev
)
end
def
reload_diff
(
merge_request
)
if
merge_request
.
source_branch
==
@branch_name
||
force_push?
merge_request
.
reload_diff
else
mr_commit_ids
=
merge_request
.
commits
.
map
(
&
:id
)
push_commit_ids
=
@commits
.
map
(
&
:id
)
matches
=
mr_commit_ids
&
push_commit_ids
merge_request
.
reload_diff
if
matches
.
any?
end
end
end
end
changelogs/unreleased/fix-merge-request-screen-deleted-source-branch.yml
deleted
100644 → 0
View file @
5018bdcd
---
title
:
Do not create a MergeRequestDiff record when source branch is deleted
merge_request
:
7481
author
:
spec/services/merge_requests/refresh_service_spec.rb
View file @
9e9965ba
...
...
@@ -227,16 +227,6 @@ describe MergeRequests::RefreshService, services: true do
end
end
context
'when the source branch is deleted'
do
it
'does not create a MergeRequestDiff record'
do
refresh_service
=
service
.
new
(
@project
,
@user
)
expect
do
refresh_service
.
execute
(
@oldrev
,
Gitlab
::
Git
::
BLANK_SHA
,
'refs/heads/master'
)
end
.
not_to
change
{
MergeRequestDiff
.
count
}
end
end
def
reload_mrs
@merge_request
.
reload
@fork_merge_request
.
reload
...
...
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