Commit dd019c2e authored by Sean McGivern's avatar Sean McGivern

Merge branch 'jc-guard-against-empty-dereferenced_target' into 'master'

Guard against nil dereferenced_target

Closes #60076

See merge request gitlab-org/gitlab-ce!27192
parents cd770031 674b926e
title: Guard against nil dereferenced_target
merge_request: 27192
type: fixed
......@@ -466,7 +466,7 @@ module Gitlab
@refs_hash = { |h, k| h[k] = [] }
(tags + branches).each do |ref|
next unless &&
next unless && && ref.dereferenced_target&.id
@refs_hash[] <<
......@@ -531,6 +531,13 @@ describe Gitlab::Git::Repository, :seed_helper do
it 'has valid commit ids as keys' do
expect(subject.keys).to all( match(Commit::COMMIT_SHA_PATTERN) )
it 'does not error when dereferenced_target is nil' do
blob_id = repository.blob_at('master', '').id
repository_rugged.tags.create("refs/tags/blob-tag", blob_id)
expect { subject }.not_to raise_error
describe '#fetch_repository_as_mirror' 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