Commit 36ccf749 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'fix_error_when_branch_is_added' into 'master'

Only check for modified paths when the branch is updated

See merge request gitlab-org/gitlab!63523
parents 51f890d0 c3329e78
...@@ -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