summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-07-01 09:51:50 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2016-07-01 09:51:50 +0000
commita647d55773b256a15a7c36732feace29285adf99 (patch)
treecf2cb11e4a06256306e7799df0eb6bace22f9e5a
parentab81ea1e8177742a0dfed2c7cf922bb03a8b6c51 (diff)
parent0601ce1871b16d212a938e684f4d9413e62c3f0b (diff)
downloadgitlab-ce-a647d55773b256a15a7c36732feace29285adf99.tar.gz
Merge branch 'avoid-instantiate-tree-for-projects-show-readme-view' into 'master'
Avoid instantiation of a Git::Tree See merge request !4997
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/projects_controller.rb7
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 4b754c2aba3..b97116af73c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,7 @@ v 8.10.0 (unreleased)
- Fix user creation with stronger minimum password requirements !4054 (nathan-pmt)
- PipelinesFinder uses git cache data
- Check for conflicts with existing Project's wiki path when creating a new project.
+ - Don't instantiate a git tree on Projects show default view
- Remove unused front-end variable -> default_issues_tracker
- Better caching of git calls on ProjectsController#show.
- Add API endpoint for a group issues !4520 (mahcsig)
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 2b1f50fd01e..12e0d5a8413 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -4,7 +4,8 @@ class ProjectsController < Projects::ApplicationController
before_action :authenticate_user!, except: [:show, :activity, :refs]
before_action :project, except: [:new, :create]
before_action :repository, except: [:new, :create]
- before_action :assign_ref_vars, :tree, only: [:show], if: :repo_exists?
+ before_action :assign_ref_vars, only: [:show], if: :repo_exists?
+ before_action :tree, only: [:show], if: :project_view_files?
# Authorize
before_action :authorize_admin_project!, only: [:edit, :update, :housekeeping, :download_export, :export, :remove_export, :generate_new_export]
@@ -303,6 +304,10 @@ class ProjectsController < Projects::ApplicationController
project.repository_exists? && !project.empty_repo?
end
+ def project_view_files?
+ current_user && current_user.project_view == 'files'
+ end
+
# Override extract_ref from ExtractsPath, which returns the branch and file path
# for the blob/tree, which in this case is just the root of the default branch.
# This way we avoid to access the repository.ref_names.