Commit f30a5d19 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'pks-changes-new-commits-fix' into 'master'

checks: Fix mismatch in `#new_commits()` signature

See merge request gitlab-org/gitlab!67581
parents 3c16ef99 3b934ec0
...@@ -168,8 +168,8 @@ class Repository ...@@ -168,8 +168,8 @@ class Repository
end end
# Returns a list of commits that are not present in any reference # Returns a list of commits that are not present in any reference
def new_commits(newrev) def new_commits(newrev, allow_quarantine: false)
commits = raw.new_commits(newrev) commits = raw.new_commits(newrev, allow_quarantine: allow_quarantine)
::Commit.decorate(commits, container) ::Commit.decorate(commits, container)
end end
......
...@@ -60,7 +60,7 @@ RSpec.describe Gitlab::Checks::ChangesAccess do ...@@ -60,7 +60,7 @@ RSpec.describe Gitlab::Checks::ChangesAccess do
describe '#commits' do describe '#commits' do
it 'calls #new_commits' do it 'calls #new_commits' do
expect(project.repository).to receive(:new_commits).and_return([]) expect(project.repository).to receive(:new_commits).and_call_original
expect(subject.commits).to eq([]) expect(subject.commits).to eq([])
end end
......
...@@ -398,11 +398,12 @@ RSpec.describe Repository do ...@@ -398,11 +398,12 @@ RSpec.describe Repository do
end end
describe '#new_commits' do describe '#new_commits' do
shared_examples '#new_commits' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
let(:repository) { project.repository } let(:repository) { project.repository }
subject { repository.new_commits(rev) } subject { repository.new_commits(rev, allow_quarantine: allow_quarantine) }
context 'when there are no new commits' do context 'when there are no new commits' do
let(:rev) { repository.commit.id } let(:rev) { repository.commit.id }
...@@ -415,6 +416,7 @@ RSpec.describe Repository do ...@@ -415,6 +416,7 @@ RSpec.describe Repository do
context 'when new commits are found' do context 'when new commits are found' do
let(:branch) { 'orphaned-branch' } let(:branch) { 'orphaned-branch' }
let!(:rev) { repository.commit(branch).id } let!(:rev) { repository.commit(branch).id }
let(:allow_quarantine) { false }
it 'returns the commits' do it 'returns the commits' do
repository.delete_branch(branch) repository.delete_branch(branch)
...@@ -426,6 +428,19 @@ RSpec.describe Repository do ...@@ -426,6 +428,19 @@ RSpec.describe Repository do
end end
end end
context 'with quarantine' do
let(:allow_quarantine) { true }
it_behaves_like '#new_commits'
end
context 'without quarantine' do
let(:allow_quarantine) { false }
it_behaves_like '#new_commits'
end
end
describe '#commits_by' do describe '#commits_by' do
let_it_be(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
......
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