summaryrefslogtreecommitdiff
path: root/lib/extracts_path.rb
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-12-18 10:31:21 +0000
committerPhil Hughes <me@iamphill.com>2017-12-18 10:31:21 +0000
commit0a05d8740ac710b814a8f89cec3fc85d6fae6be9 (patch)
treee28de222d7d7334d6784be7f612e7763f016ae4a /lib/extracts_path.rb
parenteaf2f48dc7db706fa1dea050543667f8cdebd4c4 (diff)
parentb4ea25cafa0c7768a8618c673f9a1830f27fc950 (diff)
downloadgitlab-ce-ph-es-notes-module.tar.gz
Merge branch 'master' into 'ph-es-notes-module'ph-es-notes-module
# Conflicts: # app/assets/javascripts/main.js
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 27c712a84d4..d8aca3304c5 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -40,7 +40,7 @@ module ExtractsPath
def extract_ref(id)
pair = ['', '']
- return pair unless @project
+ return pair unless @project # rubocop:disable Gitlab/ModuleWithInstanceVariables
if id =~ /^(\h{40})(.+)/
# If the ref appears to be a SHA, we're done, just split the string
@@ -104,6 +104,7 @@ module ExtractsPath
#
# Automatically renders `not_found!` if a valid tree path could not be
# resolved (e.g., when a user inserts an invalid path or ref).
+ # rubocop:disable Gitlab/ModuleWithInstanceVariables
def assign_ref_vars
# assign allowed options
allowed_options = ["filter_ref"]
@@ -130,14 +131,15 @@ module ExtractsPath
rescue RuntimeError, NoMethodError, InvalidPathError
render_404
end
+ # rubocop:enable Gitlab/ModuleWithInstanceVariables
def tree
- @tree ||= @repo.tree(@commit.id, @path)
+ @tree ||= @repo.tree(@commit.id, @path) # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
def lfs_blob_ids
blob_ids = tree.blobs.map(&:id)
- @lfs_blob_ids = Gitlab::Git::Blob.batch_lfs_pointers(@project.repository, blob_ids).map(&:id)
+ @lfs_blob_ids = Gitlab::Git::Blob.batch_lfs_pointers(@project.repository, blob_ids).map(&:id) # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
private
@@ -150,8 +152,8 @@ module ExtractsPath
end
def ref_names
- return [] unless @project
+ return [] unless @project # rubocop:disable Gitlab/ModuleWithInstanceVariables
- @ref_names ||= @project.repository.ref_names
+ @ref_names ||= @project.repository.ref_names # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
end