gitlab-org--gitlab-foss/app/services/files/multi_service.rb

33 lines
738 B
Ruby
Raw Normal View History

module Files
class MultiService < Files::BaseService
2017-04-19 20:37:44 -04:00
def create_commit!
repository.multi_action(
user: current_user,
message: @commit_message,
2017-04-19 20:37:44 -04:00
branch_name: @branch_name,
actions: params[:actions],
author_email: @author_email,
author_name: @author_name,
start_project: @start_project,
start_branch_name: @start_branch
)
end
private
2017-04-19 20:37:44 -04:00
def validate!
super
2017-02-24 15:11:10 -05:00
2017-04-19 20:37:44 -04:00
params[:actions].each do |action|
validate_action!(action)
end
end
2017-04-19 20:37:44 -04:00
def validate_action!(action)
unless Gitlab::Git::Index::ACTIONS.include?(action[:action].to_s)
raise_error("Unknown action '#{action[:action]}'")
end
end
end
end