From 7a2325e43c1fe726b4affc544449a763fb52b9e7 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 27 Mar 2019 18:15:26 -0500 Subject: Guard against nested allows with ref name caching This avoids the case: ``` allow_ref_name_caching do allow_ref_name_caching do # using-feature end end ``` --- app/models/ci/pipeline.rb | 2 +- lib/gitlab/gitaly_client.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index bbde0cdd465..be801f15cc4 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -781,7 +781,7 @@ module Ci end def git_ref - strong_memoize(:git_pref) do + strong_memoize(:git_ref) do if merge_request_event? ## # In the future, we're going to change this ref to diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index bc2f7693fdc..42195f566eb 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -302,6 +302,7 @@ module Gitlab # branch, this method allows caching of the ref name directly. def self.allow_ref_name_caching return yield unless Gitlab::SafeRequestStore.active? + return yield if ref_name_caching_allowed? begin Gitlab::SafeRequestStore[:allow_ref_name_caching] = true -- cgit v1.2.1