moved lfs blob fetch from extractspath file
This commit is contained in:
parent
3032989ad4
commit
7d2affeff1
5 changed files with 11 additions and 6 deletions
|
@ -26,7 +26,10 @@ class Projects::TreeController < Projects::ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
blob_ids = tree.blobs.map(&:id)
|
||||
|
||||
@last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit
|
||||
@lfs_blob_ids = Gitlab::Git::Blob.batch_lfs_pointers(@repo, blob_ids).map(&:id)
|
||||
end
|
||||
|
||||
format.js do
|
||||
|
|
|
@ -9,6 +9,7 @@ class ProjectsController < Projects::ApplicationController
|
|||
before_action :repository, except: [:index, :new, :create]
|
||||
before_action :assign_ref_vars, only: [:show], if: :repo_exists?
|
||||
before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?]
|
||||
before_action :lfs_blob_ids, only: [:show], if: [:repo_exists?, :project_view_files?]
|
||||
before_action :project_export_enabled, only: [:export, :download_export, :remove_export, :generate_new_export]
|
||||
|
||||
# Authorize
|
||||
|
@ -403,4 +404,9 @@ class ProjectsController < Projects::ApplicationController
|
|||
#
|
||||
redirect_to request.original_url.sub(/\.git\/?\Z/, '') if params[:format] == 'git'
|
||||
end
|
||||
|
||||
def lfs_blob_ids
|
||||
blob_ids = tree.blobs.map(&:id)
|
||||
@lfs_blob_ids = Gitlab::Git::Blob.batch_lfs_pointers(@repo, blob_ids).map(&:id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
%small
|
||||
= number_to_human_size(blob.raw_size)
|
||||
|
||||
- if blob.stored_externally?
|
||||
- if blob.stored_externally? && blob.external_storage == :lfs
|
||||
%span.label.label-lfs.append-right-5 LFS
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- is_lfs_blob = @lfs_blobs.select{|b| b.id === blob_item.id }.any?
|
||||
- is_lfs_blob = @lfs_blob_ids.include?(blob_item.id)
|
||||
%tr{ class: "tree-item #{tree_hex_class(blob_item)}" }
|
||||
%td.tree-item-file-name
|
||||
= tree_icon(type, blob_item.mode, blob_item.name)
|
||||
|
|
|
@ -127,10 +127,6 @@ module ExtractsPath
|
|||
|
||||
@hex_path = Digest::SHA1.hexdigest(@path)
|
||||
@logs_path = logs_file_project_ref_path(@project, @ref, @path)
|
||||
|
||||
blob_ids = tree.blobs.map(&:id)
|
||||
@lfs_blobs = Gitlab::Git::Blob.batch_lfs_pointers(@repo, blob_ids)
|
||||
|
||||
rescue RuntimeError, NoMethodError, InvalidPathError
|
||||
render_404
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue