diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-27 18:15:26 -0500 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-27 18:17:25 -0500 |
commit | 7a2325e43c1fe726b4affc544449a763fb52b9e7 (patch) | |
tree | c04c49e55a30e10dc0030a0527cad8ae64570204 | |
parent | db759c5d9ca3ba9c1610b05d6725c1427d653bef (diff) | |
download | gitlab-ce-sh-fix-gitaly-find-commit-caching.tar.gz |
Guard against nested allows with ref name cachingsh-fix-gitaly-find-commit-caching
This avoids the case:
```
allow_ref_name_caching do
allow_ref_name_caching do
# using-feature
end
end
```
-rw-r--r-- | app/models/ci/pipeline.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client.rb | 1 |
2 files changed, 2 insertions, 1 deletions
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 |