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
This commit is contained in:
commit
dd019c2e0b
3 changed files with 13 additions and 1 deletions
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue