2015-09-17 01:45:22 -04:00
|
|
|
module Files
|
|
|
|
class CreateDirService < Files::BaseService
|
|
|
|
def commit
|
2017-02-15 18:28:29 -05:00
|
|
|
repository.create_dir(
|
2016-11-14 15:02:10 -05:00
|
|
|
current_user,
|
|
|
|
@file_path,
|
2016-12-08 04:08:25 -05:00
|
|
|
message: @commit_message,
|
|
|
|
branch_name: @target_branch,
|
2016-11-14 15:02:10 -05:00
|
|
|
author_email: @author_email,
|
|
|
|
author_name: @author_name,
|
2017-01-06 10:29:13 -05:00
|
|
|
start_project: @start_project,
|
|
|
|
start_branch_name: @start_branch)
|
2015-09-17 01:45:22 -04:00
|
|
|
end
|
2015-10-19 17:52:46 -04:00
|
|
|
|
|
|
|
def validate
|
|
|
|
super
|
|
|
|
|
|
|
|
unless @file_path =~ Gitlab::Regex.file_path_regex
|
|
|
|
raise_error(
|
|
|
|
'Your changes could not be committed, because the file path ' +
|
|
|
|
Gitlab::Regex.file_path_regex_message
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2015-09-17 01:45:22 -04:00
|
|
|
end
|
|
|
|
end
|