Commit a05f0a46 authored by Mario de la Ossa's avatar Mario de la Ossa

Extract EE-specific code from app/services/commits/create_service.rb

parent b8670f18
module Commits
class CreateService < ::BaseService
prepend EE::Commits::CreateService
ValidationError = Class.new(StandardError)
ChangeError = Class.new(StandardError)
......@@ -37,7 +39,6 @@ module Commits
def validate!
validate_permissions!
validate_repository_size!
validate_on_branch!
validate_branch_existance!
......@@ -52,12 +53,6 @@ module Commits
end
end
def validate_repository_size!
if project.above_size_limit?
raise_error(Gitlab::RepositorySizeError.new(project).commit_error)
end
end
def validate_on_branch!
if !@start_project.empty_repo? && !@start_project.repository.branch_exists?(@start_branch)
raise_error('You can only create or edit files when you are on a branch')
......
module EE
module Commits
module CreateService
extend ::Gitlab::Utils::Override
private
override :validate!
def validate!
super
validate_repository_size!
end
def validate_repository_size!
if project.above_size_limit?
raise_error(Gitlab::RepositorySizeError.new(project).commit_error)
end
end
end
end
end
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