Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
691f1c49
Commit
691f1c49
authored
Dec 08, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simply give result if result[:status] == :error
parent
cf677378
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
app/services/create_branch_service.rb
app/services/create_branch_service.rb
+3
-11
No files found.
app/services/create_branch_service.rb
View file @
691f1c49
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment