summaryrefslogtreecommitdiff
path: root/lib/extracts_path.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-12-15 21:25:23 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-12-15 21:25:23 +0000
commit223cb3788a744f9b1b92959d3337000358db108b (patch)
tree77858e7ec0e2a731ddb7791f99d75ef4c23b4b54 /lib/extracts_path.rb
parentb3606cff38b9defc764706ed6529a9e27dcf4847 (diff)
parenta1a323392d4f0cb59eab2e215fa4010b84fc122d (diff)
downloadgitlab-ce-41117-empty-state.tar.gz
Merge branch 'master' into 41117-empty-state41117-empty-state
* master: (71 commits) Update CHANGELOG.md for 10.2.5 Change CI config to use new base image fix issue #39843 Incorrect guidance stating blocked users will be removed from groups and projects as members Add changelog entry Update tests for toggle design change Update toggle styles to use icons Use icons instead of string labels for toggles Fix Rubocop offense in QA project specs Add SAST docs Fix UX issues in system info page Update svg package version Make sure user email is read only when synced with LDAP Add note about automatic pipelines when enabling Auto DevOps Backport changes from EE Docs update documentation guidelines Don't use Markdown cache for stubbed settings in specs Fix remaining calls to GitLab QA factories Rename QA scenarios to make factory concept explicit Export JS classes as modules Make rubocop happy ...
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 721ed97bb6b..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"]
@@ -127,13 +128,18 @@ module ExtractsPath
@hex_path = Digest::SHA1.hexdigest(@path)
@logs_path = logs_file_project_ref_path(@project, @ref, @path)
-
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) # rubocop:disable Gitlab/ModuleWithInstanceVariables
end
private
@@ -146,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