diff options
author | Phil Hughes <me@iamphill.com> | 2017-12-14 13:10:20 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-12-14 13:10:20 +0300 |
commit | 7d2affeff1885fb9984fed1088c8dffdc41a7320 (patch) | |
tree | b572cd9484abad0cfadee819a52a7db49ce8def2 /app/controllers | |
parent | 3032989ad4e8b93e5ad60cdbb817d1be5f9edacb (diff) |
moved lfs blob fetch from extractspath file
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/tree_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index f3719059f88..2998ec21dca 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -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 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3882fa4791d..bce3a8d42e4 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 |