Commit 0e3ea2dd authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'pks-checks-skip-integrity-lfs-deletions' into 'master'

checks: Skip LFS checks when deleting refs

See merge request gitlab-org/gitlab!55609
parents 81c5e507 7916f078
---
title: 'checks: Skip LFS checks when deleting refs'
merge_request: 55609
author:
type: fixed
...@@ -13,6 +13,7 @@ module Gitlab ...@@ -13,6 +13,7 @@ module Gitlab
return unless project.lfs_enabled? return unless project.lfs_enabled?
return if skip_lfs_integrity_check return if skip_lfs_integrity_check
return if deletion?
logger.log_timed(LOG_MESSAGE) do logger.log_timed(LOG_MESSAGE) do
lfs_check = Checks::LfsIntegrity.new(project, newrev, logger.time_left) lfs_check = Checks::LfsIntegrity.new(project, newrev, logger.time_left)
......
...@@ -39,13 +39,26 @@ RSpec.describe Gitlab::Checks::LfsCheck do ...@@ -39,13 +39,26 @@ RSpec.describe Gitlab::Checks::LfsCheck do
end end
end end
context 'deletion' do context 'with deletion' do
let(:changes) { { oldrev: oldrev, ref: ref } } shared_examples 'a skipped integrity check' do
it 'skips integrity check' do
expect(project.repository).not_to receive(:new_objects)
expect_any_instance_of(Gitlab::Git::LfsChanges).not_to receive(:new_pointers)
subject.validate!
end
end
it 'skips integrity check' do context 'with missing newrev' do
expect(project.repository).not_to receive(:new_objects) it_behaves_like 'a skipped integrity check' do
let(:changes) { { oldrev: oldrev, ref: ref } }
end
end
subject.validate! context 'with blank newrev' do
it_behaves_like 'a skipped integrity check' do
let(:changes) { { oldrev: oldrev, newrev: Gitlab::Git::BLANK_SHA, ref: ref } }
end
end end
end end
......
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