Commit 00f9fec1 authored by Pavel Shutsin's avatar Pavel Shutsin

Merge branch 'sh-fix-rugged-list-commits-by-oid-no-repo' into 'master'

Fix destruction of projects with pipelines

See merge request gitlab-org/gitlab!77941
parents fff31020 1cbf0709
......@@ -31,6 +31,9 @@ module Gitlab
oids.map { |oid| rugged_find(repo, oid) }
.compact
.map { |commit| decorate(repo, commit) }
# Match Gitaly's list_commits_by_oid behavior
rescue ::Gitlab::Git::Repository::NoRepository
[]
end
override :find_commit
......
......@@ -486,6 +486,16 @@ RSpec.describe Gitlab::Git::Commit, :seed_helper do
expect(commits.first.sha).to eq(SeedRepo::Commit::ID)
expect(commits.second.sha).to eq(SeedRepo::FirstCommit::ID)
end
context 'when repo does not exist' do
let(:no_repository) { Gitlab::Git::Repository.new('default', '@does-not-exist/project', '', 'bogus/project') }
it 'returns empty commits' do
commits = described_class.batch_by_oid(no_repository, oids)
expect(commits.count).to eq(0)
end
end
end
context 'when oids is empty' 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