diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-19 12:12:41 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-19 12:13:18 +0300 |
commit | d6a87e24a5170dffe224d2938709ebadd1875bcc (patch) | |
tree | 09f3c99c39f1045a82b9e229ba89b9d1d12899f0 /app/models/repository.rb | |
parent | 6385b49572542066d3eb5c197ba0208bfa3158fb (diff) |
Fix implementation of Repository.with_forbidden_access
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index c4bd6d303dc..f9ba28c1d4d 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -12,11 +12,11 @@ class Repository attr_accessor :path_with_namespace, :project def self.with_forbidden_access - @@forbidden_access ||= 0 - @@forbidden_access += 1 + Thread.current[:repository_forbidden_access] ||= 0 + Thread.current[:repository_forbidden_access] += 1 yield - rescue - @@forbidden_access -= 1 + ensure + Thread.current[:repository_forbidden_access] -= 1 end def initialize(path_with_namespace, project) @@ -27,7 +27,7 @@ class Repository def raw_repository return nil unless path_with_namespace - raise 'Repository access is forbidden' if @@forbidden_access + raise 'Repository access is forbidden' if Thread.current[:repository_forbidden_access].to_i > 0 @raw_repository ||= Gitlab::Git::Repository.new(path_to_repo) end |