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:
authorCiro Santilli <ciro.santilli@gmail.com>2014-09-21 12:29:52 +0400
committerCiro Santilli <ciro.santilli@gmail.com>2014-09-21 13:43:05 +0400
commitad47993ac46cef672600f2384ee5fa2e661ec8be (patch)
tree07769b4efeb4c18762b3ed0e705179a5423926c1 /app/services/create_branch_service.rb
parentfda61a047ffb9b04bc4dd38e897088fde17fb3c1 (diff)
Factor error and success methods from services.
Diffstat (limited to 'app/services/create_branch_service.rb')
-rw-r--r--app/services/create_branch_service.rb20
1 files changed, 7 insertions, 13 deletions
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index 79b8239602e..901f67bafb3 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -1,5 +1,7 @@
-class CreateBranchService
- def execute(project, branch_name, ref, current_user)
+require_relative 'base_service'
+
+class CreateBranchService < BaseService
+ def execute(branch_name, ref)
valid_branch = Gitlab::GitRefValidator.validate(branch_name)
if valid_branch == false
return error('Branch name invalid')
@@ -22,17 +24,9 @@ class CreateBranchService
end
end
- def error(message)
- {
- message: message,
- status: :error
- }
- end
-
def success(branch)
- {
- branch: branch,
- status: :success
- }
+ out = super()
+ out[:branch] = branch
+ out
end
end