diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-01-09 20:30:04 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-01-12 12:54:55 +0300 |
commit | 4f00a05152c105814f17a5f582d493435de96747 (patch) | |
tree | 76eab649b7c832afb47ad3e37ead6eb7a4bdaa93 /lib/gitlab/bare_repository_import | |
parent | 3fde958f36fa9c3bfa30ed1f73108e0640722926 (diff) |
Introduce PredicateMemoization cop and fix offenses
with StrongMemoize
Diffstat (limited to 'lib/gitlab/bare_repository_import')
-rw-r--r-- | lib/gitlab/bare_repository_import/repository.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/bare_repository_import/repository.rb b/lib/gitlab/bare_repository_import/repository.rb index 85b79362196..c0c666dfb7b 100644 --- a/lib/gitlab/bare_repository_import/repository.rb +++ b/lib/gitlab/bare_repository_import/repository.rb @@ -1,6 +1,8 @@ module Gitlab module BareRepositoryImport class Repository + include ::Gitlab::Utils::StrongMemoize + attr_reader :group_path, :project_name, :repo_path def initialize(root_path, repo_path) @@ -41,11 +43,15 @@ module Gitlab private def wiki? - @wiki ||= repo_path.end_with?('.wiki.git') + strong_memoize(:wiki) do + repo_path.end_with?('.wiki.git') + end end def hashed? - @hashed ||= repo_relative_path.include?('@hashed') + strong_memoize(:hashed) do + repo_relative_path.include?('@hashed') + end end def repo_relative_path |