debian-mirror-gitlab/app/services/files/create_service.rb

29 lines
727 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
module Files
2015-09-25 12:07:36 +05:30
class CreateService < Files::BaseService
2017-08-17 22:00:37 +05:30
def create_commit!
2019-09-04 21:01:54 +05:30
transformer = Lfs::FileTransformer.new(project, repository, @branch_name)
2018-03-17 18:26:18 +05:30
2018-05-09 12:01:36 +05:30
result = transformer.new_file(@file_path, @file_content)
create_transformed_commit(result.content)
2018-03-17 18:26:18 +05:30
end
private
def create_transformed_commit(content_or_lfs_pointer)
2017-08-17 22:00:37 +05:30
repository.create_file(
current_user,
@file_path,
2018-03-17 18:26:18 +05:30
content_or_lfs_pointer,
2017-08-17 22:00:37 +05:30
message: @commit_message,
branch_name: @branch_name,
author_email: @author_email,
author_name: @author_name,
start_project: @start_project,
start_branch_name: @start_branch)
2014-09-02 18:07:02 +05:30
end
end
end