Commit d4a89c3d authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 89fe979b dd019c2e
---
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