Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-08 10:31:42 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-12-08 10:31:42 +0300
commit691f1c496834078ba41209597558259d20790a0b (patch)
tree2536d1818f220ca1b9af2c90f5395513b4d8dd0c /app/services/create_branch_service.rb
parentcf677378ee8104e7505cf0670ad45a51613af575 (diff)
Simply give result if result[:status] == :error
Diffstat (limited to 'app/services/create_branch_service.rb')
-rw-r--r--app/services/create_branch_service.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index 076f976ed06..1b5e504573a 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -1,8 +1,9 @@
class CreateBranchService < BaseService
def execute(branch_name, ref)
- failure = validate_new_branch(branch_name)
+ result = ValidateNewBranchService.new(project, current_user).
+ execute(branch_name)
- return failure if failure
+ return result if result[:status] == :error
new_branch = repository.add_branch(current_user, branch_name, ref)
@@ -18,13 +19,4 @@ class CreateBranchService < BaseService
def success(branch)
super().merge(branch: branch)
end
-
- private
-
- def validate_new_branch(branch_name)
- result = ValidateNewBranchService.new(project, current_user).
- execute(branch_name)
-
- error(result[:message]) if result[:status] == :error
- end
end