summaryrefslogtreecommitdiff
path: root/app/controllers/projects_controller.rb
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-06-20 21:41:46 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-06-20 21:44:22 +0200
commit79c521f5df560ca6a8bd379dc211ccc1cf3ee3c4 (patch)
tree5422474c997a4cc1ea2b3e7ce64ff9fb951b3485 /app/controllers/projects_controller.rb
parentdf6639070911abd14d76d53891682270473e9bf3 (diff)
downloadgitlab-ce-79c521f5df560ca6a8bd379dc211ccc1cf3ee3c4.tar.gz
Provide default branch/file path for ProjectsController#show18709-reduce-git-calls
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r--app/controllers/projects_controller.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 78ceaf3237f..2b1f50fd01e 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -303,8 +303,14 @@ class ProjectsController < Projects::ApplicationController
project.repository_exists? && !project.empty_repo?
end
- # Override get_id from ExtractsPath, which returns the branch and file path
+ # 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.
+ def extract_ref(_id)
+ [get_id, '']
+ end
+
+ # Override get_id from ExtractsPath in this case is just the root of the default branch.
def get_id
project.repository.root_ref
end