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
author:
type: fixed
......@@ -466,7 +466,7 @@ module Gitlab
@refs_hash = Hash.new { |h, k| h[k] = [] }
(tags + branches).each do |ref|
next unless ref.target && ref.name
next unless ref.target && ref.name && ref.dereferenced_target&.id
@refs_hash[ref.dereferenced_target.id] << ref.name
end
......
......@@ -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) )
end
it 'does not error when dereferenced_target is nil' do
blob_id = repository.blob_at('master', 'README.md').id
repository_rugged.tags.create("refs/tags/blob-tag", blob_id)
expect { subject }.not_to raise_error
end
end
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