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
Kazuhiko Shiozaki
gitlab-ce
Commits
95b84e2c
Commit
95b84e2c
authored
Apr 01, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move branch creation logic in service
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
8f3701ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+1
-5
app/services/create_branch_service.rb
app/services/create_branch_service.rb
+13
-0
No files found.
app/controllers/projects/branches_controller.rb
View file @
95b84e2c
...
@@ -16,11 +16,7 @@ class Projects::BranchesController < Projects::ApplicationController
...
@@ -16,11 +16,7 @@ class Projects::BranchesController < Projects::ApplicationController
end
end
def
create
def
create
@repository
.
add_branch
(
params
[
:branch_name
],
params
[
:ref
])
CreateBranchService
.
new
.
execute
(
project
,
params
[
:branch_name
],
params
[
:ref
],
current_user
)
if
new_branch
=
@repository
.
find_branch
(
params
[
:branch_name
])
Event
.
create_ref_event
(
@project
,
current_user
,
new_branch
,
'add'
)
end
redirect_to
project_branches_path
(
@project
)
redirect_to
project_branches_path
(
@project
)
end
end
...
...
app/services/create_branch_service.rb
0 → 100644
View file @
95b84e2c
class
CreateBranchService
def
execute
(
project
,
branch_name
,
ref
,
current_user
)
repository
=
project
.
repository
repository
.
add_branch
(
branch_name
,
ref
)
new_branch
=
repository
.
find_branch
(
branch_name
)
if
new_branch
Event
.
create_ref_event
(
project
,
current_user
,
new_branch
,
'add'
)
end
new_branch
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