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
6cd0d7f2
Commit
6cd0d7f2
authored
Mar 17, 2020
by
Michelle Gill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure current diff is used for CODEOWNERS
parent
1218d19e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
changelogs/unreleased/bug-codeowner-diffs.yml
changelogs/unreleased/bug-codeowner-diffs.yml
+5
-0
ee/app/services/ee/merge_requests/refresh_service.rb
ee/app/services/ee/merge_requests/refresh_service.rb
+3
-2
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
+20
-1
No files found.
changelogs/unreleased/bug-codeowner-diffs.yml
0 → 100644
View file @
6cd0d7f2
---
title
:
Ensure MR diff exists before codeowner check
merge_request
:
author
:
type
:
security
ee/app/services/ee/merge_requests/refresh_service.rb
View file @
6cd0d7f2
...
...
@@ -9,11 +9,12 @@ module EE
override
:refresh_merge_requests!
def
refresh_merge_requests!
update_approvers
reset_approvals_for_merge_requests
(
push
.
ref
,
push
.
newrev
)
check_merge_train_status
super
update_approvers
reset_approvals_for_merge_requests
(
push
.
ref
,
push
.
newrev
)
end
# Note: Closed merge requests also need approvals reset.
...
...
ee/spec/services/ee/merge_requests/refresh_service_spec.rb
View file @
6cd0d7f2
...
...
@@ -61,7 +61,7 @@ describe MergeRequests::RefreshService do
end
describe
'#update_approvers'
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
,
username:
'default-codeowner'
)
}
let
(
:current_user
)
{
merge_request
.
author
}
let
(
:service
)
{
described_class
.
new
(
project
,
current_user
)
}
let
(
:enable_code_owner
)
{
true
}
...
...
@@ -86,6 +86,25 @@ describe MergeRequests::RefreshService do
forked_merge_request
end
it
'gets called in a specific order'
do
allow_any_instance_of
(
MergeRequests
::
BaseService
).
to
receive
(
:inspect
).
and_return
(
true
)
expect
(
service
).
to
receive
(
:reload_merge_requests
).
ordered
expect
(
service
).
to
receive
(
:update_approvers
).
ordered
expect
(
service
).
to
receive
(
:reset_approvals_for_merge_requests
).
ordered
subject
end
it
'creates an approval rule based on current diff'
do
file
=
File
.
read
(
Rails
.
root
.
join
(
'ee'
,
'spec'
,
'fixtures'
,
'codeowners_example'
))
project
.
repository
.
create_file
(
owner
,
'CODEOWNERS'
,
file
,
{
branch_name:
'test'
,
message:
'codeowners'
})
subject
expect
(
another_merge_request
.
approval_rules
.
size
).
to
eq
(
3
)
expect
(
another_merge_request
.
approval_rules
.
first
.
rule_type
).
to
eq
(
'code_owner'
)
end
context
'when code owners disabled'
do
let
(
:enable_code_owner
)
{
false
}
...
...
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