Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/api/repositories.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'lib/api/repositories.rb')
-rw-r--r--lib/api/repositories.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index f274406e225..20320d1b7ae 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -29,14 +29,13 @@ module API
not_found!
end
- def assign_blob_vars!
+ def assign_blob_vars!(limit:)
authorize! :download_code, user_project
@repo = user_project.repository
begin
- @blob = Gitlab::Git::Blob.raw(@repo, params[:sha])
- @blob.load_all_data!(@repo)
+ @blob = Gitlab::Git::Blob.raw(@repo, params[:sha], limit: limit)
rescue StandardError
not_found! 'Blob'
end
@@ -55,7 +54,7 @@ module API
use :pagination
end
get ':id/repository/tree' do
- ref = params[:ref] || user_project.try(:default_branch) || 'master'
+ ref = params[:ref] || user_project.default_branch
path = params[:path] || nil
commit = user_project.commit(ref)
@@ -71,7 +70,8 @@ module API
requires :sha, type: String, desc: 'The commit hash'
end
get ':id/repository/blobs/:sha/raw' do
- assign_blob_vars!
+ # Load metadata enough to ask Workhorse to load the whole blob
+ assign_blob_vars!(limit: 0)
no_cache_headers
@@ -83,7 +83,7 @@ module API
requires :sha, type: String, desc: 'The commit hash'
end
get ':id/repository/blobs/:sha' do
- assign_blob_vars!
+ assign_blob_vars!(limit: -1)
{
size: @blob.size,