Commit c3329e78 authored by Marc Shaw's avatar Marc Shaw

Only check for modified paths when the branch is updated

Changelog: fixed
MR: gitlab.com/gitlab-org/gitlab/-/merge_requests/63523
EE: true
parent 3621b7dc
...@@ -49,7 +49,7 @@ module EE ...@@ -49,7 +49,7 @@ module EE
end end
def code_owners_updated? def code_owners_updated?
return if push.branch_removed? return unless push.branch_updated?
push.modified_paths.find { |path| ::Gitlab::CodeOwners::FILE_PATHS.include?(path) } push.modified_paths.find { |path| ::Gitlab::CodeOwners::FILE_PATHS.include?(path) }
end end
......
...@@ -128,6 +128,12 @@ RSpec.describe MergeRequests::RefreshService do ...@@ -128,6 +128,12 @@ RSpec.describe MergeRequests::RefreshService do
it_behaves_like 'does not refresh the code owner rules' it_behaves_like 'does not refresh the code owner rules'
end end
context 'when the branch is created' do
let(:oldrev) { Gitlab::Git::BLANK_SHA }
it_behaves_like 'does not refresh the code owner rules'
end
end end
context 'when the branch is not protected' do context 'when the branch is not protected' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment