Commit 8b727fea authored by Douwe Maan's avatar Douwe Maan Committed by Stan Hu

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

parent b2363483
...@@ -492,12 +492,8 @@ class Repository ...@@ -492,12 +492,8 @@ class Repository
end end
def root_ref def root_ref
if raw_repository # 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 raw_repository&.root_ref or raise Gitlab::Git::Repository::NoRepository # rubocop:disable Style/AndOr
else
# When the repo does not exist we raise this error so no data is cached.
raise Gitlab::Git::Repository::NoRepository
end
end end
cache_method :root_ref cache_method :root_ref
......
---
title: Don't cache a nil repository root ref to prevent caching issues
merge_request:
author:
type: fixed
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