Don't cache a nil repository root ref to prevent caching issues

This commit is contained in:
Douwe Maan 2018-02-16 15:15:32 +01:00 committed by Stan Hu
parent b236348388
commit 8b727fea81
2 changed files with 7 additions and 6 deletions

View File

@ -492,12 +492,8 @@ class Repository
end
def root_ref
if raw_repository
raw_repository.root_ref
else
# When the repo does not exist we raise this error so no data is cached.
raise Gitlab::Git::Repository::NoRepository
end
# When the repo does not exist, or there is no root ref, we raise this error so no data is cached.
raw_repository&.root_ref or raise Gitlab::Git::Repository::NoRepository # rubocop:disable Style/AndOr
end
cache_method :root_ref

View File

@ -0,0 +1,5 @@
---
title: Don't cache a nil repository root ref to prevent caching issues
merge_request:
author:
type: fixed