Commit db0651dd authored by Douwe Maan's avatar Douwe Maan

Don't calculate push size for more changes if limit is already execeeded

parent a396e7ae
......@@ -89,16 +89,16 @@ module EE
# clear stale lock files.
project.repository.clean_stale_repository_files
# rubocop: disable CodeReuse/ActiveRecord
push_size_in_bytes = changes_list.sum do |change|
repository.new_blobs(change[:newrev]).sum(&:size)
end
# rubocop: enable CodeReuse/ActiveRecord
push_size_in_bytes = 0
changes_list.each do |change|
push_size_in_bytes += repository.new_blobs(change[:newrev]).sum(&:size) # rubocop: disable CodeReuse/ActiveRecord
if project.changes_will_exceed_size_limit?(push_size_in_bytes)
raise ::Gitlab::GitAccess::UnauthorizedError, ::Gitlab::RepositorySizeError.new(project).new_changes_error
end
end
end
def check_size_limit?
strong_memoize(:check_size_limit) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment