diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-20 09:07:57 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-20 09:07:57 +0000 |
commit | 7881eb30eaa8b01dbcfe87faa09927c75c7d6e45 (patch) | |
tree | 298bc8d2c62b2f2c29cb8ecbcf3de3eaaa6466d9 /app/services/create_branch_service.rb | |
parent | 64b66e0cb6d1bfd27abf24e06653f00bddb60597 (diff) | |
download | gitlab-ce-7881eb30eaa8b01dbcfe87faa09927c75c7d6e45.tar.gz |
Add latest changes from gitlab-org/gitlab@12-6-stable-ee
Diffstat (limited to 'app/services/create_branch_service.rb')
-rw-r--r-- | app/services/create_branch_service.rb | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb deleted file mode 100644 index d58cb0f9e2b..00000000000 --- a/app/services/create_branch_service.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -class CreateBranchService < BaseService - def execute(branch_name, ref, create_master_if_empty: true) - create_master_branch if create_master_if_empty && project.empty_repo? - - result = ValidateNewBranchService.new(project, current_user) - .execute(branch_name) - - return result if result[:status] == :error - - new_branch = repository.add_branch(current_user, branch_name, ref) - - if new_branch - success(new_branch) - else - error("Invalid reference name: #{branch_name}") - end - rescue Gitlab::Git::PreReceiveError => ex - error(ex.message) - end - - def success(branch) - super().merge(branch: branch) - end - - private - - def create_master_branch - project.repository.create_file( - current_user, - '/README.md', - '', - message: 'Add README.md', - branch_name: 'master' - ) - end -end |